This plugin hasn’t been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.

WP-MP-Contact

Description

Tested on Gravity Forms 1.8.19, will probably work under versions from 1.6.

WP-MP-Contact is a Gravity Forms add-in for UK Member of Parliament email campaigns. Using API calls to They Work for You, a campaigning organisation can add an ‘MP-Contact’ field to their gravity form which allows pre-population of an (editable) message to send to an MP.

Unfortunately, the Guardian has decomissioned their politics API that allowed for this plugin to return an MP’s email address without any further input from the administrator. This plugin now uses a Google Spreadsheet as the data source for email addresses. These can either be purchased from DeHavilland, or entered manually from http://parliament.uk. The lookup still uses the Guardian’s format of constituency names, so the data in the Google Spreadsheet is looked up from the Guardian Constituency in column A. An example spreadsheet is available at https://docs.google.com/a/properdesign.co.uk/spreadsheets/d/1OCmI1t_6Ou_1CwcK3u0IfhRq3UZ6KaK0Qn5zEfp-DJ4/edit#gid=0

On the front-end, the user enters their UK postcode. If the postcode is valid, WP-MP-Contact will show a slide-down drawer with the MP’s details and a pre-populated message from the campaigning organisation (set by the administrator in Gravity Forms settings).

The user has the ability to edit the message that the campaigner has pre-populated before sending an email to the MP.

In the Gravity Forms back end, all submissions are recorded in the usual Gravity Forms entries interface.

MP-Contact comes with minimal styling out of the box and doesn’t pre-suppose how it will look in your theme. Go on, get stuck into styling it, it’s only a bit of flexbox.

Feel free to contribute to the project. You can find the repo on Github at https://github.com/shankiesan/wp-mp-contact

WP-MP-Contact was developed by Proper Design (http://properdesign.rs)

Acknowledgements:

  • Renewable UK (http://www.renewableuk.com/) and Action for Renewables (http://www.actionforrenewables.org/) for funding the initial development of this Gravity Forms add-in
  • They Work for You’s consituency API (http://www.theyworkforyou.com/api/)
  • rubenarakelyan’s PHP class for They Work for You (https://github.com/rubenarakelyan/twfyapi)
  • WPSmith for the tutorial that got it all started (http://wpsmith.net/2011/plugins/how-to-create-a-custom-form-field-in-gravity-forms-with-a-terms-of-service-form-field-example/)
  • The Agency for showing how to work with complex fields (http://theagencyonline.co.uk/2014/07/custom-multiple-input-form-for-gravity-fields/)
  • Pippin Williamson for the usual and oft-forgotten explanation of the proper way to do AJAX in WordPress (https://pippinsplugins.com/process-ajax-requests-correctly-in-wordpress-plugins/)

Changelog

1.0 – Initial Release
1.0.2 – Changes handling of Guardian API calls to CURL
1.0.3 – Adds prepend and append to the MP message
1.1 – Moves email source to Google Docs

Contributors & Developers

This is open source software. The following people have contributed to this plugin.

Contributors

Browse the code