Commenter Emails

Author:Scott Reilly
First released:2009-06-15
Last update:2015-03-18
Compatibility:WP 3.1 – 4.1.8
Download:[ zip ]

Extract a listing of all commenter emails.

Extended Description

Via the admin page added by the plugin, Comments -> Commenter Emails, the admin is presented with the following information:

  • A total count of all unique commenters to the blog
  • A button to download the entire list of unique commenters’ email addresses (and, optionally, their website URL) in CSV (comma-separated values) format
  • The entire list of unique commenters’ email addresses and names

The plugin only considers approved comments and does not exclude from its listing any known email addresses (i.e. admin and post author email addresses).

Links: Plugin Homepage | Plugin Directory Page | Author Homepage

Find out more at the plugin’s WordPress Plugin Repository page.


Click to see full-size image.

  1. commenter-emails screenshot 1

    A screenshot of the admin page created by the plugin to view commenter emails.


  1. Unzip inside the /wp-content/plugins/ directory (or install via the built-in WordPress plugin installer)
  2. Activate the plugin through the ‘Plugins’ admin menu in WordPress
  3. View the commenter email information reported in the WordPress admin via Comments -> Commenter Emails


The plugin exposes six filters for hooking. Typically, customizations utilizing these hooks would be put into your active theme’s functions.php file, or used by another plugin.

c2c_commenter_emails_show_csv_button (filter)

The ‘c2c_commenter_emails_show_csv_button’ hook allows you to customize whether the button to download a CSV file of the commenter emails list should be present on the plugin’s admin settings page. By default this is true.


  • $show_button (bool): Whether the download button is shown; it is ‘true’ by default.


// Disable the download button
add_filter( 'c2c_commenter_emails_show_csv_button', '__return_false' );

c2c_commenter_emails_show_emails (filter)

The ‘c2c_commenter_emails_show_emails’ hook allows you to customize whether the listing of emails should appear on the plugin’s admin settings page. By default this is true.


  • $show_emails (bool): Whether the listing of emails is shown’ it is ‘true’ by default.


// Disable showing the emails listing
add_filter( 'c2c_commenter_emails_show_emails', '__return_false' );

c2c_commenter_emails_filename (filter)

The ‘c2c_commenter_emails_filename’ hook allows you to customize the name used for the .csv file when being downloaded. By default this is ‘commenter-emails.csv’.


  • $filename (string): The filename. By default this is ‘commenter-emails.csv’.


 * Change the default filename to embed today's date for the Commenter Emails plugin.
 * @param string $filename The filename for the CSV file.
 * @return string.
function change_ce_filename( $filename ) {
    $date = date('m-d-Y', strtotime('today')); // Get today's date in m-d-Y format (i.e. 02-25-2010)
    return "emails-$date.csv";
add_filter( 'c2c_commenter_emails_filename', 'change_ce_filename' );

manage_commenter_emails_options (filter)

The ‘manage_commenter_emails_options’ hook allows you to customize the capability required to access the commenter emails admin page. You should be certain that you’ve created the capability and assigned that capability to the desired user(s). By default this is the ‘manage_options’ capability.


  • $options (string): Capability name. By default this is the ‘manage_options’ capability.


 * Change the capability needed to see the Commenter Emails admin page for the Commenter Emails plugin.
 * @param string $capability The necessary capability.
 * @return string
function change_ce_cap( $capability ) {
    return 'manage_commenter_emails';
add_filter( 'manage_commenter_emails_options', 'change_ce_cap' );

c2c_commenter_emails_fields (filter)

The ‘c2c_commenter_emails_fields’ hook allows you to customize the user fields included in the download CSV file. By default the CSV file includes comment_author and comment_author_email.


  • $fields (array): Array of field names. Items must correspond to columns in the comments table. By default this is array( 'comment_author', 'comment_author_email' ). Whether explicitly included or not, ‘comment_author_email’ will always be output in the CSV.


 * Include the commenter's IP address in the download CSV for the Commenter Emails plugin.
 * @param array $fields The comment email fields to include in the CSV output.
 * @return array
function change_ce_fields( $fields ) {
    $fields[] = 'comment_author_IP';
    return $fields;
add_filter( 'c2c_commenter_emails_fields', 'change_ce_fields' );

c2c_commenter_emails_field_separator (filter)

The ‘c2c_commenter_emails_field_separator’ hook allows you to customize the separator used in the CSV file.


  • $separator (string): String to be used as the data separator in the CSV file. Default is ‘,’.


 * Change the data fields separator to '|' for Commenter Emails plugin.
 * @param string $separator The defautl separator.
 * @return string
function change_ce_field_separator( $separator ) {
    return '|';
add_filter( 'c2c_commenter_emails_field_separator', 'change_ce_field_separator' );

Release Log

2.3 (2015-03-17)

  • Ensure only valid comment fields can be specified as first argument to get_emails()
  • Use the default argument value of ‘fields’ argument if it is explicitly set as empty
  • Remove is_admin() check preventing class from being defined (to facilitate unit testing and general use by other code)
  • Add unit tests
  • Minor code reformatting (spacing, bracing)
  • Note compatibility through WP 4.1+
  • Change documentation links to to be https
  • Update copyright date (2015)
  • Add plugin icon
  • Regenerate .pot

2.2.1 (2013-12-30)

  • Note compatibility through WP 3.8+
  • Update copyright date (2014)
  • Change donate link
  • Minor readme.txt tweaks (mostly spacing)
  • Add banner
  • Update screenshot


  • Show comment author URLs in listing
  • Add checkbox to allow inclusion of comment author URLs in CSV
  • Add check to prevent execution of code if file is directly accessed
  • Re-license as GPLv2 or later (from X11)
  • Add ‘License’ and ‘License URI’ header tags to readme.txt and plugin file
  • Remove ending PHP close tag
  • Minor documentation tweaks
  • Note compatibility through WP 3.5+
  • Update copyright date (2013)
  • Move screenshot into repo’s assets directory


  • Add support for localization
  • Add .pot
  • Move CSS into commenter-emails.css and enqueue
  • Add enqueue_admin_css()
  • Store plugin settings page id in private static ‘plugin_page’
  • Hook download_csv() to plugin-specific load action
  • Add version() to return plugin version
  • Minor code reformatting (spacing)
  • Note compatibility through WP 3.3+
  • Drop support for versions of WP older than 3.1
  • Update screenshot (now based on WP 3.3)
  • Add ‘Domain Path’ directive to top of main plugin file
  • Add link to plugin directory page to readme.txt
  • Update copyright date (2012)


  • Fix bug preventing download of .csv file
  • Fix bug where filters were applied too late (after download handling)
  • Add optional arguments $fields and $output to get_emails(); method now returns array of user objects
  • Add filter ‘c2c_commenter_emails_fields’ to allow overriding default fields included in CSV file
  • Add filter ‘c2c_commenter_emails_field_separator’ to allow overriding field separator
  • Improve csv generation by using fputcsv()
  • Now also list commenter names in addition to emails on the plugin’s settings page
  • Change format of download filename, e.g. comment-emails-2011-06-26-1123.csv (where numbers represent date and time of download)
  • Note compatibility through WP 3.2+
  • Minor code formatting change (spacing)
  • Fix plugin homepage and author links in description in readme.txt


  • Switch from object instantiation to direct class invocation
  • Explicitly declare all functions public static and class variables private static
  • Note compatibility through WP 3.1+
  • Update copyright date (2011)


  • Allow filtering of default filename for saved csv file, via ‘c2c_commenter_emails_filename’ filter
  • Allow filtering of whether settings page should actually list the email addresses, via ‘c2c_commenter_emails_show_csv_button’ filter
  • Allow filtering of whether settings page should actually show the download csv button, via ‘c2c_commenter_emails_show_emails’ filter
  • Move everything in constructor into new init() which gets called on admin_init
  • Add ‘Listing’ link to plugin’s entry in plugins list that links to plugin’s admin page
  • Check for is_admin() before defining class rather than during constructor
  • Assign object instance to global variable, $c2c_commenter_emails, to allow for external manipulation
  • Rename class from ‘CommenterEmails’ to ‘c2c_CommenterEmails’
  • Remove docs from top of plugin file (all that and more are in readme.txt)
  • Note support for WP 2.9+, 3.0+
  • Minor code reformatting (spacing)
  • Add PHPDoc documentation
  • Add package info to top of file
  • Add Filters and Upgrade Notice sections to readme.txt
  • Update copyright date
  • Remove trailing whitespace in header docs


  • Require ‘manage_options’ permission to access commenter email listing
  • Noted dropped support for versions of WP older than 2.6


  • Fixed unnecessary second call to get_emails()
  • Used plugins_url() instead of hardcoded path
  • Used $pagenow instead of manual means for checking current page
  • Check it’s in the admin before doing anything
  • CSV filename is now a class variable
  • Added c2c logo to top of admin page
  • Added extended description
  • Removed pre-WP2.6 support
  • Noted compatibility with WP 2.6+, 2.7+, and 2.8+


  • Initial release

Copyright & Disclaimer

Copyright © 2009-2015 by Scott Reilly (aka coffee2code)

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
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Discussion / Support

Have any questions, comments, or suggestions? Please provide them via the plugin’s support forum. I’ll do my best to reply in a timely fashion and help as best I can.

Unfortunately, I cannot provide guaranteed support, nor do I provide support via any other means.

Was this plugin useful useful to you? Consider giving it a rating. If you’re inclined to give it a poor rating, please first post to the support forum to give me a chance to address or explain the situation.