WordPress.org

Ready to get started?Download WordPress

Plugin Directory

Commenter Emails

Extract a listing of all commenter emails.

Filters

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.

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.
add_filter( 'c2c_commenter_emails_filename', 'change_ce_filename' );
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";
}

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
add_filter( 'manage_commenter_emails_options', 'change_ce_cap' );
function change_ce_cap( $capability ) {
    return 'manage_commenter_emails';
}

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
add_filter( 'c2c_commenter_emails_fields', 'change_ce_fields' );
function change_ce_fields( $fields ) {
    $fields[] = 'comment_author_IP';
    return $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 '|'
add_filter( 'c2c_commenter_emails_field_separator', 'change_ce_field_separator' );
function change_ce_field_separator( $separator ) {
    return '|';
}

Requires: 3.1 or higher
Compatible up to: 3.8.3
Last Updated: 2013-12-30
Downloads: 9,041

Ratings

5 stars
5 out of 5 stars

Support

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,1,1
100,1,1
100,1,1
100,1,1
100,1,1