WP Manifestindependent plugin directory
manifest / email / contact-campaign

Contact Campaign

Contact your local politician campaign for Wordpress

★ 0stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/johanneswilm/contact-campaign/archive/refs/heads/main.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

Contact Campaign WordPress Plugin 🇸🇪

A powerful WordPress plugin for creating email campaigns to contact politicians and representatives. This plugin allows users to easily reach out to their elected officials with pre-formatted messages while providing flexibility for customization. Specially optimized for Swedish political contexts and fully translated to Swedish.

Features

Core Functionality

  • Campaign Creation: Create unlimited email campaigns with custom descriptions and messaging
  • Politician Management: Add politicians with complete contact information including email, social media, and websites
  • Email Templates: Pre-formatted email messages with dynamic placeholders (Swedish templates included)
  • Responsive Design: Mobile-friendly interface that works on all devices
  • Social Media Integration: Connect via Twitter, Facebook, and official websites
  • Swedish Political Context: Pre-configured for Swedish parties, positions, and geographic areas
  • Multilingual Support: Full Swedish translation with easy localization for other languages

User Experience

  • One-Click Email: Direct mailto links for immediate email sending
  • Pre-filled Email Client: Open user's email client with pre-formatted message
  • Email Preview: Modal preview before sending emails
  • Social Media Sharing: Tweet directly to politicians or visit their social profiles
  • Interactive Cards: Hover effects and smooth animations

Administrative Features

  • Easy Management: Intuitive admin interface for campaign and politician management
  • Shortcode Integration: Simple shortcodes for displaying campaigns anywhere
  • Analytics Ready: Built-in event tracking for Google Analytics and Facebook Pixel
  • Accessibility: Full WCAG compliance with screen reader support
  • Performance Optimized: Lazy loading and optimized CSS/JS delivery

Installation

Automatic Installation

  1. Download the plugin zip file
  2. Go to WordPress Admin → Plugins → Add New
  3. Click "Upload Plugin" and select the zip file
  4. Click "Install Now" and then "Activate"

Manual Installation

  1. Upload the contact-campaign folder to /wp-content/plugins/
  2. Activate the plugin through the WordPress 'Plugins' menu
  3. Navigate to "Contact Campaigns" in the admin menu to get started

Quick Start Guide

Step 1: Create Your First Campaign

  1. Go to Contact Campaigns → Add New Campaign
  2. Enter a campaign title (e.g., "Support Climate Action")
  3. Write a description explaining the issue
  4. Customize the email template with your message
  5. Set an email subject line
  6. Click "Create Campaign"

Step 2: Add Politicians

  1. Click "Add Politician" in the campaign editor
  2. Fill in the politician's information:
    • Name (required)
    • Email (required)
    • Position (e.g., "Senator", "Representative")
    • Party (e.g., "Democratic", "Republican")
    • District (e.g., "5th District", "At-Large")
    • Social Media (Twitter, Facebook, Website)
  3. Click "Save Politician"
  4. Repeat for all relevant politicians

Step 3: Display Your Campaign

  1. Copy the shortcode from the campaign editor
  2. Paste it into any post or page: [contact_campaign id="1"]
  3. Publish and view your campaign in action!

Shortcode Usage

Basic Usage

[contact_campaign id="1"]

Advanced Usage

[contact_campaign id="1" columns="4"]

Parameters

  • id (required): The campaign ID
  • columns: Number of columns (1-6, default: 3)

Email Template Placeholders

Use these placeholders in your email templates for dynamic content:

  • [POLITICIAN_NAME] - The politician's full name
  • [POLITICIAN_EMAIL] - The politician's email address
  • [POLITICIAN_POSITION] - Their official position/title
  • [POLITICIAN_PARTY] - Their political party
  • [POLITICIAN_DISTRICT] - Their district or constituency

Example Template

Dear [POLITICIAN_NAME],

I am writing to you as your constituent in [POLITICIAN_DISTRICT] regarding climate change legislation.

As my [POLITICIAN_POSITION], I urge you to support comprehensive climate action that will:
- Reduce carbon emissions by 50% by 2030
- Invest in renewable energy infrastructure
- Create green jobs in our community

Thank you for your leadership on this critical issue.

Sincerely,
[YOUR NAME]
[YOUR ADDRESS]

Customization

Styling

The plugin includes comprehensive CSS that can be customized:

  1. Override in your theme's style.css:
    
    .contact-campaign-wrapper {
     /* Your custom styles */
    }

.politician-card { / Customize politician cards / }


2. **Create a custom CSS file** in your theme:
```php
// In your theme's functions.php
wp_enqueue_style(
    'custom-contact-campaign',
    get_stylesheet_directory_uri() . '/contact-campaign-custom.css',
    array('contact-campaign-frontend'),
    '1.0.0'
);

Colors

The plugin uses CSS custom properties for easy color customization:

.contact-campaign-wrapper {
    --primary-color: #3498db;
    --success-color: #28a745;
    --text-color: #333;
    --border-color: #e1e5e9;
}

JavaScript Hooks

Add custom tracking or functionality:

// Custom tracking function
window.contactCampaignTrack = function(eventName, eventData) {
    // Your custom analytics code
    console.log('Event:', eventName, eventData);
};

// Access the public API
ContactCampaign.trackEvent('custom_event', {
    campaign_id: '1',
    custom_data: 'value'
});

Database Structure

Campaigns Table (wp_contact_campaigns)

  • id - Unique campaign ID
  • title - Campaign title
  • description - Campaign description (HTML)
  • email_template - Email message template
  • email_subject - Default email subject
  • status - Campaign status (active/inactive)
  • created_at - Creation timestamp
  • updated_at - Last update timestamp

Politicians Table (wp_contact_politicians)

  • id - Unique politician ID
  • campaign_id - Associated campaign
  • name - Politician's full name
  • email - Email address
  • position - Official title/position
  • party - Political party
  • district - District or constituency
  • photo_url - Profile photo URL
  • twitter_handle - Twitter username
  • facebook_url - Facebook profile URL
  • website_url - Official website
  • sort_order - Display order
  • created_at - Creation timestamp

Security Features

  • Nonce Verification: All AJAX requests are protected with WordPress nonces
  • Capability Checks: Admin functions require proper user capabilities
  • Data Sanitization: All input is properly sanitized and validated
  • XSS Prevention: Output is properly escaped
  • SQL Injection Protection: Uses prepared statements for all database queries

Performance Optimization

  • Efficient Queries: Optimized database queries with proper indexing
  • Asset Optimization: Minified CSS and JavaScript
  • Conditional Loading: Scripts only load when needed
  • Caching Friendly: Compatible with all major caching plugins
  • Lazy Loading: Images and heavy content load on demand

Browser Support

  • Modern Browsers: Chrome 60+, Firefox 55+, Safari 12+, Edge 79+
  • Mobile Browsers: iOS Safari 12+, Chrome Mobile 60+
  • Progressive Enhancement: Graceful degradation for older browsers
  • Accessibility: WCAG 2.1 AA compliant

Troubleshooting

Common Issues

Campaign not displaying

  • Check that the shortcode campaign ID is correct
  • Ensure the campaign status is "active"
  • Verify politicians have been added to the campaign

Email buttons not working

  • Check that politicians have valid email addresses
  • Ensure the user's device has an email client configured
  • Test with different email clients (Gmail, Outlook, etc.)

Styling issues

  • Check for theme conflicts by switching to a default theme
  • Verify CSS is loading properly in browser developer tools
  • Check for JavaScript errors in the console

Admin access issues

  • Ensure user has "manage_options" capability
  • Check for plugin conflicts by deactivating other plugins
  • Verify WordPress version compatibility

Debug Mode

Enable debug mode by adding to your URL:

?cc_debug=1

This will log all events to the browser console.

Hooks and Filters

Actions

// Before campaign display
do_action('contact_campaign_before_display', $campaign_id);

// After campaign display
do_action('contact_campaign_after_display', $campaign_id);

// When politician is saved
do_action('contact_campaign_politician_saved', $politician_id, $campaign_id);

Filters

// Modify email template before display
add_filter('contact_campaign_email_template', function($template, $politician) {
    // Your modifications
    return $template;
}, 10, 2);

// Customize politician card HTML
add_filter('contact_campaign_politician_card', function($html, $politician) {
    // Your modifications
    return $html;
}, 10, 2);

Contributing

We welcome contributions! Please follow these guidelines:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes with proper documentation
  4. Add tests for new functionality
  5. Submit a pull request

Development Setup

# Clone the repository
git clone https://github.com/yourusername/contact-campaign.git

# Install dependencies
npm install

# Build assets
npm run build

# Watch for changes during development
npm run watch

License

This plugin is licensed under the GPL v2 or later.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

Support

  • Documentation: Full documentation available at GitHub Repository
  • Bug Reports: Report issues on GitHub Issues
  • Feature Requests: Suggest new features on GitHub
  • Swedish Documentation: See README-sv.md for Swedish documentation

Developer

Johannes Wilm

Changelog

Version 1.0.0

  • Initial release
  • Campaign creation and management
  • Politician database with full contact info
  • Responsive frontend display
  • Email integration with pre-filled templates
  • Social media connectivity
  • Admin interface with intuitive politician management
  • Analytics tracking integration
  • Accessibility features (WCAG 2.1 AA compliant)
  • Mobile-responsive design
  • Swedish localization and political context
  • Swedish translation (contact-campaign-sv_SE.po/mo)
  • Swedish-specific examples and templates
  • Support for Swedish political parties and positions

Swedish Political Features

This plugin is specifically adapted for the Swedish political system:

Supported Political Parties

  • Socialdemokraterna (Social Democrats)
  • Moderaterna (Moderate Party)
  • Sverigedemokraterna (Sweden Democrats)
  • Centerpartiet (Centre Party)
  • Vänsterpartiet (Left Party)
  • Kristdemokraterna (Christian Democrats)
  • Liberalerna (Liberals)
  • Miljöpartiet (Green Party)

Political Positions

  • Riksdagsledamot (Member of Parliament)
  • Minister (Minister)
  • Kommunfullmäktigeledamot (Municipality Council Member)
  • Regionfullmäktigeledamot (County Council Member)

Geographic Areas

  • All Swedish municipalities (kommuner)
  • All Swedish counties (län)
  • Pre-configured examples for Stockholm, Göteborg, Malmö, Uppsala

Language Support

  • Complete Swedish translation
  • Swedish email templates with appropriate tone and structure
  • Swedish political terminology and context
  • Easy localization for other languages

Files Structure

contact-campaign/
├── contact-campaign.php          # Main plugin file
├── README.md                     # English documentation
├── README-sv.md                  # Swedish documentation
├── LICENSE                       # GPL v2 license
├── CHANGELOG.md                  # Version history
├── CONTRIBUTORS.md               # Contributor recognition
├── .gitignore                    # Git ignore rules
├── package.json                  # Development dependencies
├── example.html                  # English example
├── example-sv.html              # Swedish example
├── languages/
│   ├── contact-campaign.pot     # Translation template
│   ├── contact-campaign-sv_SE.po # Swedish translation source
│   ├── contact-campaign-sv_SE.mo # Swedish translation compiled
│   ├── generate-pot.sh          # Translation generation script
│   └── TRANSLATION-GUIDE.md     # Translation instructions
├── templates/                    # PHP templates
│   ├── admin-campaigns-list.php # Campaign management interface
│   ├── admin-campaign-form.php  # Campaign creation/editing form
│   └── frontend-campaign.php    # Public campaign display
├── assets/
│   ├── css/                     # Stylesheets
│   │   ├── admin.css           # Admin interface styles
│   │   └── frontend.css        # Frontend styles
│   └── js/                      # JavaScript files
│       ├── admin.js            # Admin functionality
│       └── frontend.js         # Frontend interactivity

Made with ❤️ for democracy and civic engagement

This plugin was created to make it easier for citizens to contact their elected representatives and make their voices heard in the democratic process. Specially crafted for Swedish democracy but adaptable worldwide.

Utvecklad av Johannes Wilm för svensk demokrati och medborgarengagemang.

Development

Prerequisites

  • Node.js 14+ and npm 6+
  • PHP 7.4+ with gettext extension
  • WordPress development environment

Getting Started

# Clone the repository
git clone https://github.com/johanneswilm/contact-campaign.git
cd contact-campaign

# Install development dependencies
npm install

# Build minified assets
npm run build

# Watch for changes during development
npm run dev

Development Scripts

  • npm run build - Build production assets (CSS and JS minification)
  • npm run dev - Watch files and rebuild on changes
  • npm run lint - Lint CSS and JavaScript files
  • npm run pot - Generate translation template file
  • npm run clean - Remove built files
  • npm run zip - Create plugin distribution zip

Translation Development

# Generate new translation template
npm run pot

# Create new language (example: German)
cp languages/contact-campaign.pot languages/contact-campaign-de_DE.po

# Edit translations in the .po file, then compile
msgfmt languages/contact-campaign-de_DE.po -o languages/contact-campaign-de_DE.mo

Code Standards

  • Follow WordPress coding standards
  • Use proper internationalization for all user-facing text
  • Maintain accessibility compliance (WCAG 2.1 AA)
  • Write semantic HTML5 and modern CSS
  • Use progressive enhancement for JavaScript

Testing

  • Test across different WordPress versions (5.0+)
  • Test with different themes
  • Verify translations work correctly
  • Test accessibility with screen readers
  • Validate responsive design on various devices