CongressLookup

Description

CongressLookup is a free WordPress plugin giving your site visitor an easy way to find United States US senators and representatives. CongressLookup makes it easier to launch a grassroots campaign for your favorite cause and will keep your visitors on your site instead of sending them to elsewhere to find their legislators.

Where The Data Comes From
CongressLookup uses data provided by Google Maps GeoCoding API and Sunlight Labs API currently hosted by ProPublica.org.

Google Maps GeoCoding API
By using this plugin you are bound by the Google Maps terms of use. Google GeoCoding API limits use to 2,500 requests per IP address per day. We have added a cache feature (default setting is 30 minutes) you can set to reduce the number of requests made to the API. To obtain a Google Maps API key there is a link in: WP Admin > Settings > CongressLookup > Configuration, or do the following:

1. Go to the Google API Console.
2. Create or select a project.
3. Click Continue to enable the API and any related services.
4. On the Credentials page, get an API key.

ProPublica API
CongressLookup uses free databases provided by the ProPublica.org through the use of their Sunlight Labs Congress 3 API. NOTE: No API key is currently needed.

The following information can be displayed for each legislator. You can turn any of these on/off in the Admin settings: Title, First Name, Last Name, Picture, Chamber, State Rank, State Name, Website, Contact Form, Fax, Phone, Party, Name Suffix, Middle Name, Facebook ID, Youtube ID, Twitter ID, Votesmart ID, Office, Term End, and Term Start

Using CongressLookup Plugin
The minimum information needed to get results is a 5-digit zip code. However, some zip codes cover more than one congressional district so the more of the address is entered the more accurate the results will be.

CongressLookup is implemented on your WordPress site with use of a shortcode. See the Installation and FAQs for more information.

Customizing The Look of the Plugin
There are three theme options available: No Theme, Modern and Custom Theme.

  • No Theme: Uses the core styling from your theme without adding any of it’s own.
  • Custom Theme: Allow you to create your own look using CSS and comes with a demo area to preview your changes.
  • Modern Theme:

Support
If you have any problems, please see our Trouble Shooting Guide before putting in a support request.

Please use the CongressLookup plugin support tab here on the WordPress.org website. Keeping support questions and answers public helps everyone. However, feel free to contact us here for any other help you may need.

Official Website
http://congresslookup.com

Troubleshooting

Broken Links: If the resulting links to congress people resources are broken (return a 404 error) this is a problem with ProPublica’s Sunlight Labs Congress3 database not being up-to-date. Please contact them directly to have these errors fixed: https://www.propublica.org/datastore/contact

If CongressLookup is not working properly, please try the following steps:

1. Make sure you are using the most recent version of the plugin.

2. Make sure your server is running at least PHP 5.4.

3. When creating your Google Maps API, set Key Restrictions to “None”.

4. PLUGIN CONFLICT: Please try deactivating all plugins except CongressLookup. If CongressLookup does then work, turn on one plugin at a time and test it again until you find the plugin it conflicts with. Please let us know what plugin this is.

5. THEME CONFLICT: If there is still an issue after testing for a plugin conflict, and all other plugins are turned off, please try temporarily switching to another theme. We recommend trying one of the default WordPress themes.

6. SERVER SETTINGS: If none of the above has helped, please tell your webmaster to enable allow-url-fopen in php.ini
http://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen
When doing this, disable the cache option for testing, then when allow-url-fopen is enabled and CongressLookup works only then enable the cache again.

7. If you are still having any issues, please put in a support request.

Screenshots

  • CongressLookup frontend with Modern theme screenshot-1.jpg
  • WP Admin > Settings > CongressLookup > Configuration screenshot-2.jpg

Installation

  1. Unzip CongressLookup.zip and Upload folder to the /wp-content/plugins/ directory
  2. Activate the plugin through the ‘Plugins’ menu in WordPress
  3. Or in your Plugin page “Add Plugin” search: enter “CongressLookup” then install and activate.
  4. Obtain a Google Maps API
    • Go to the Google API Console.
    • Create or select a project.
    • Click Continue to enable the API and any related services.
    • On the Credentials page, get an API key.
  5. Enter Google Maps API key and configure in: WP Admin > Settings > CongressLookup
  6. Use the following shortcodes in a page, post, widget, or/and sidebars:
    Search for Senators and Representatives: [CongressLookup]
    Search for Senators only: [CongressLookup show="senator"]
    Search for Representatives only: [CongressLookup show="representative"]
  7. You can use the following codes in your template, placed outside the loop:

  8. You can create shortcodes with different configurations by going to: WP Admin > Settings > CongressLookup > Custom Shortcode.
  9. If you have any problems, please see our Trouble Shooting Guide before putting in a support request.

FAQ

Why does it take so long for CongressLookup to install on my site?

Per their terms of server, you may not hotlink to the Sunlight Labs photo files. Therefore, you must host the images locally on your server. We include the copy of the photos zip file with the plugin and, because of it’s size, it may cause the plugin to install slower then you are used to.

Where does the legislator information comes from

CongressLookup uses data provided by both Google GeoCoding API and the Sunlight Labs Congress3 API which is currently hosted by ProPublica.org.

What are Google Maps API Terms of Use?

By using this plugin you are bound by both the Google Maps terms of use and the Google GeoCoding API terms of use. The information presented here and on our website is for informational purposes only and is not intended to be legal advise.

Why use Google Maps GeoCoding API?

Google GeoCoding API is used to obtain the longitude and latitude of a particular address. This is the most accurate way to determine within which legislative districts an address is located.

How accurate is Google GeoCoding data?

GeoCoding is not 100% accurate. Sometimes an entered address will not return the correct location. For this reason, we have included a Google Map the visitor can use to verify the location is correct.

What if the map location is different from the address entered?

The plugin’s Google map has a movable pointer you can click and drag to more accurately target the desired location. The address in the input window (and the corresponding legislators) will automatically recalculate each time the red marker is repositioned.

How do I tell Google their information is wrong?

You can tell Google of any inaccuracies by clicking the link in the lower right corner of the map: “Report a map error”.

Are there limits on how many addresses can be looked up with CongressLookup plugin?

We, the developers, created CongressLookup plugin to be free and do not limit how much you can use it, however, both Google GeoCoding and ProPublica.org Terms of Use have restrictions and/or limits imposed when using their APIs. Please consult their websites for more information on the legal use of their APIs.

What are the Google GeoCoding API limitations?

Google GeoCoding API limits its use to 2,500 requests per IP address per day.

How does the CongressLookup Admin cache setting help with the Google GeoCoding limit?

We have added a cache feature you can set to reduce the number of requests made to the API. The default setting will clear the cache every 30 minutes. If you anticipate 2,500 requests per day will not be enough for your site, even with the caching, please contact us about a custom solution.

What is the Sunlight Labs / ProPublica API used for?

CongressLookup uses free databases provided by the ProPublica.org whose premium data products are designed to deliver insights, with data, analysis, and practical documentation you won’t find anywhere else. Part of what they do is maintain free databases of information about the US government. We make use of their legislator information and legislator photos databases in CongressLookup plugin.

Where is the CongressLookup settings page located?

WP Admin > Settings > CongressLookup

Why are the pictures not showing or are the wrong pictures?

Members of Congress change after elections and sometimes leave or are replaced midterm. When this happens, your locally hosted zip file of their pictures needs to be updated to stay accurate. There is a button in the plugin Admin settings to download the most recent copy of the picture zip file. Note: when the picture folder changes, you will receive a notice in your WP Admin to update the pictures.

What legislator information can be displayed?

The following information can be displayed for each legislator. You can turn any of these on/off in the Admin settings:

  • Title
  • First Name
  • Last Name
  • Picture
  • Chamber
  • State Rank
  • State Name
  • Website
  • Contact Form
  • Fax
  • Phone
  • Party
  • Name Suffix
  • Middle Name
  • Facebook ID
  • Youtube ID
  • Twitter ID
  • Votesmart ID
  • Office
  • Term End
  • Term Start
How much information must be entered in the address field to get results?

Minimum information needed is a 5-digit zip code. However, some zip codes cover more than one congressional district so the more of the address is entered, the more accurate the results will be.

Can I change the look of the plugin?

There are three themes to choose from:

  • Modern Theme: By default.
  • No Theme: Uses the core styling from your theme without adding any of it’s own.
  • Custom Theme: Allows you to create your own look using CSS and comes with a demo area to preview your changes.
How do I use CongressLookup on my site?

Use the following shortcode in a page, post, widget, or/and sidebar:

[CongressLookup]
[CongressLookup show=’senator’]
[CongressLookup show=’representative’]

Use the following code in your template, outside of the loop:

<?php echo do_shortcode(“[CongressLookup]”); ?>
<?php echo do_shortcode(“[CongressLookup show=’senator’]”); ?>
<?php echo do_shortcode(“[CongressLookup show=’representative’]”); ?>

You can custom configure shortcodes by going to: WP Admin > Settings > CongressLookup > Custom Shortcode.

Do you have “hooks” to modify the output?

Yes. As of version 2.1.8 we have added the following hooks:

  • “congress_results” filter to modify array returned by api
  • “congress_field” filter to modify field title
  • “congress_value” filter to modify field value
  • “congress_output” filter to modify output per field

CONGRESSLOOKUP HOOK FILTERS EXAMPLES

add_filter( 'congress_results', 'congress_results_callback', 10 );
function congress_results_callback( $results ){
  //$out = '<pre>' . print_r($results, 1) . '</pre>';

  $out .= '<p>add_filter( "congress_results" ) example:</p>';
  $out .= '<table>';
  $out .= '<tr>
        <td>Name</td>
        <td>Picture</td>
        <td>Facebook</td>
      </tr>';
  foreach($results as $i => $arr){
    $out .= '<tr>
          <td>' . esc_html($arr['full_name']) . '</td>
          <td>' . '<img src="' . $arr['pic'] . '">' . '</td>
          <td>' . '<a href="https://www.facebook.com/' . $arr['facebook_id'] . '">' . $arr['facebook_id'] . '</a>' . '</td>
        </tr>';
    }
  $out .= '</table>';

  return $out;
}

//add_filter( 'congress_field', 'congress_field_callback', 10, 2 );
function congress_field_callback($field_title, $key){
  if( $key == 'facebook_id'){
    return 'FB';
  }else{
    return $field_title;
  }
}

//add_filter( 'congress_value', 'congress_value_callback', 10, 3 );
function congress_value_callback($field_value, $key, $value){
  if( $key == 'office'){
    return $field_value . ' <a href="#">(MAP)</a>';
  }else{
    return $field_value;
  }
}

//add_filter( 'congress_output', 'congress_output_callback', 10, 6 );
function congress_output_callback($li, $key, $value, $field_title, $field_value, $result){
  return "<li>{$field_title} => {$field_value}</li>";
}
How do I contact support?

Please use the CongressLookup plugin Support Tab above. Keeping support questions and answers public helps everyone. But feel free to contact us here for any other help you may need.

Official Website
http://congresslookup.com

Reviews

Initial Issues, but Support Went Above and Beyond

For a free plugin, the Support staff went way above and beyond to assist in getting the program to work on my site. I had some difficulty getting the plugin to work that really did not have anything to do with the plugin structure. It will be a great addition to my website.

Read all 3 reviews

Contributors & Developers

“CongressLookup” is open source software. The following people have contributed to this plugin.

Contributors

Changelog

2.1.8

  • added “congress_results” filter to modify array returned by api
  • added “congress_field” filter to modify field title
  • added “congress_value” filter to modify field value
  • added “congress_output” filter to modify output per field

2.1.7

  • Add CSS to wrap long URLs
  • Add custom javascript call (if the function exist) everytime api called

2.1.6

  • Fix undefined variables
  • Fix shortcode bug when displaying senator or representative only

2.1.5

  • Add shortcode creation area
  • Modify admin interface
  • Update get photos function
  • Update internal cache API call using wp transient api
  • Update API call to get congress members
  • Fix bugs 404 when calling API
  • Add “What to display” options at shortcode level

2.1.4

  • Enable multiple map call
  • Merge geocode.js into main plugin file
  • Add option to input Google Map API Key
  • Update picture files
  • Update do_shortcode usage at readme.txt file

2.1.3

  • Update 28 November 2016
    Sunlight Labs database and API is now run by Propublica.org They are not requiring an API key but CongressLookup still expects one so enter any character string in the API Key field to make it work.

2.1.2

  • Update 20 April 2016
    Fixed “window.onload” function conflict that occurred with another plugin.

2.1.1

  • Update 21 February 2015
  1. Fixed an “Undefined property” error.

2.1

  • Update 01 June 2014
  1. Added two new shortcodes for displaying (1) US Senators only, and (2) US Representatives only.

2.0

  • Update 15 May 2014
  1. Replaced the use of deprecated Sunlight Labs Congress API with more comprehensive Sunlight Congress API.
  2. Added more congressperson stats, now available from new API, with checkboxes in admin.
  3. Added ability for admin to choose to display only Senators, only Representatives, or both (default) from a dropdown menu in admin.
  4. Minor CSS changes

1.0

  • Original version, 23 August 2012