WordPress.org

Ready to get started?Download WordPress

Forums

E-Mail List Generator (2 posts)

  1. ObscureSound
    Member
    Posted 4 years ago #

    Any plugin that generates a list of e-mails from people that have commented on my WordPress blog over the past month or so?

    I would like to notify them of a feature premiering on Monday.

  2. tugbucket
    Member
    Posted 4 years ago #

    Not a plug-in but this does what you are asking for:

    <?php
    global $current_user;
    get_currentuserinfo();
    if ($current_user->user_level == 10 ) {
    $query = "SELECT * from $wpdb->comments WHERE date(comment_date) >= date(now()-interval 30 day)";
    echo "<h3>Email adddresses list</h3>";
    $result = mysql_query($query) or die(mysql_error());
    echo "<ul>";
    while ($rowA = mysql_fetch_array($result)) {
    echo "<li>".$rowA[comment_author_email]."</li>";
    }
    echo "</ul>";
    
    // -----
    
    echo "<h3>Email ready string</h3>";
    $peeps = array();
    $result2 = mysql_query($query) or die(mysql_error());
    while ($rowB = mysql_fetch_array($result2)) {
    $peeps[] = $rowB[comment_author_email];
    }
    $emailready = implode(', ', $peeps);
    echo $emailready;
    } else {
    // nada
    };
    ?>

    It will create a list of all the emails of users who commented in the last 30 days. Under that it will then place all those emails into 1 line separated by commas so you can just copy and paste the whole this into your email client.

    It will only show for the admin when they are signed in (since you shouldn't make the list of emails public). Just add that to a page or something, run it, copy it and then delete it if you want.

Topic Closed

This topic has been closed to new replies.

About this Topic