Commenter Emails

Author:Scott Reilly
Version:2.5.1
First released:2009-06-15
Last update:2019-06-26
Compatibility:WP 4.1 – 5.2.2
Download:[ zip ]
Description:

Extract a listing of data for all commenters (email addresses, names, URLs), and an option…

Extended Description

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

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

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 | GitHub | Author Homepage

Hooks

The plugin exposes six filters for hooking. Code using these filters should ideally be put into a mu-plugin or site-specific plugin (which is beyond the scope of this readme to explain). Less ideally, you could put them in your active theme’s functions.php file.

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.

Arguments:

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

Example:

// 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.

Arguments:

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

Example:

// 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’.

Arguments:

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

Example:

/**
 * 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.

Arguments:

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

Example:

/**
 * 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.

Arguments:

  • $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.

Example:

/**
 * 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.

Arguments:

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

Example:

/**
 * 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' );

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

Screenshots

Click to see full-size image.

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

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

  2. A screenshot of the plugin's settings page with the "Help" tab expanded to reveal input for limited the listing of commenters to those who commented on specified posts.

    A screenshot of the plugin’s settings page with the “Help” tab expanded to reveal input for limited the listing of commenters to those who commented on specified posts.

Installation

  1. Install via the built-in WordPress plugin installer. Or download and unzip commenter-emails.zip inside the plugins directory for your site (typically wp-content/plugins/)
  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

Release Log

2.5.1 (2019-06-25)

  • Change: Update unit test install script and bootstrap to use latest WP unit test repo
  • Change: Note compatibility through WP 5.2+

2.5 (2019-04-17)

  • New: Add README.md file
  • New: Add CHANGELOG.md file and move all but most recent changelog entries into it
  • New: Add inline documentation for hooks
  • New: Add GitHub link to readme.txt
  • Change: Initialize plugin on ‘plugins_loaded’ action instead of on load
  • Change: Merge do_init() into init()
  • Change: Prevent object instantiation
    • Add private __construct()
    • Add private __wakeup()
  • Change: Cast return values for a number of hooks to boolean or array
  • Change: (Hardening) Encode plugin basename before use as part of a URL
  • Change: Add missing translation textdomain
  • Change: Unit tests: Minor whitespace tweaks to bootstrap
  • Change: Note compatibility through WP 5.1+
  • Change: Rename readme.txt section from ‘Filters’ to ‘Hooks’
  • Change: Modify formatting of hook name in readme to prevent being uppercased when shown in the Plugin Directory
  • Change: Update copyright date (2019)
  • Change: Update License URI to be HTTPS

2.4.1 (2017-02-28)

  • Change: Update unit test bootstrap
    • Default WP_TESTS_DIR to /tmp/wordpress-tests-lib rather than erroring out if not defined via environment variable
    • Enable more error output for unit tests
  • Change: Note compatibility through WP 4.7+
  • Change: Change description
  • Change: Minor readme.txt content and formatting tweaks
  • Change: Update copyright date (2017)
  • New: Add LICENSE file

Copyright & Disclaimer

Copyright © 2009-2019 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
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
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 WordPress.org 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.