WordPress.org

Ready to get started?Download WordPress

Forums

List of Registered Blog Members - eMail Addresses (11 posts)

  1. ausrmusings
    Member
    Posted 6 years ago #

    It's quite possible I'm missing something in the Admin panel, but I don't think so. I am trying to figure out how to get a list of the eMail addresses that are registered on my blog. I have about 17 pages of registered members in the Admin panel, and it's rather cumbersome to copy each page into MS Word and delete everything but the eMail addresses. Any help appreciated, please.

  2. Michael Torbert
    WordPress Virtuoso
    Posted 6 years ago #

    What are you trying to do exactly? If you want to send an email to everyone, there are plugins that do this. If you just want that one column from the database, a one line sql query will do that.

  3. ausrmusings
    Member
    Posted 6 years ago #

    Send an eMail to everyone, yes, that is something I want to do, but I can't do it via the plugins because my host only permits 100 eMails to be sent per hour. At the moment, I have a little over 700 registered members. I need to extract the eMail addresses so that I can input them into another mailing facility. When you speak of the one line sql query, that's a bit over my head. :) If you can elaborate a little bit, I just might catch on and be able to do it. :)

    Paula

  4. Michael Torbert
    WordPress Virtuoso
    Posted 6 years ago #

    Create a file called emails.php
    Open it in notepad or whatever text editor you like.

    Copy/Paste

    <?php
    $con = mysql_connect("host, probably localhost", "mysql username", "mysql password");
    mysql_select_db("database name");
    $sql = 'SELECT user_email FROM prefix_users LIMIT 0, 300 ';
    $result = mysql_query($sql);
    if ( ! $result )
    { echo mysql_error(); }
    else{
    while ($row = mysql_fetch_assoc($result)) {
    echo $row['user_email'].',';
    }
    }
    ?>

    Edit the hostname, database name, database username, database password at the top with your own mysql login info. If you don't know it, look in wp-config.php and it's at the top.

    Save the file. Upload it to your server somewhere. Then browse to the file in your web browser. For example, if you upload it to the root of your website's directory, where the primary index file is, you can just go to domain.com/emails.php

    This show you all the email addresses up to 300, separated by commas.

  5. ausrmusings
    Member
    Posted 6 years ago #

    Okay, it's coming up with an error that says:

    Table 'DB_NAME.prefix_users' doesn't exist

    No clue what that means, but thanks for trying to help. :)

  6. Michael Torbert
    WordPress Virtuoso
    Posted 6 years ago #

    Replace prefix with your prefix. By default I think it's wp_ but it's whatever you set it to during installation. If you don't remember what it is or if you even have one, open wp-config.php in your blog's root directory. You'll see
    $table_prefix = 'wp_'; or something. Whatever is in between the ' ' is your prefix. So in this case you would have wp_users in your sql query.

  7. ausrmusings
    Member
    Posted 6 years ago #

    Below is what I have in my email.php file, which I put in the root. I'm getting HTTP 404 Not Found in the browser. Call me blonde, I must be overlooking something so simple. The X's are where I changed information based on what is in the wp_config file, and then there is wp_users below that. Am I really blonde?

    <?php
    $con = mysql_connect("localhost", "XXXXXXXX_XXXXX", "XXXXXXXXXXXX");
    mysql_select_db("XXXXXXXX_XXXXX");
    $sql = 'SELECT user_email FROM wp_users LIMIT 0, 300 ';
    $result = mysql_query($sql);
    if ( ! $result )
    { echo mysql_error(); }
    else{
    while ($row = mysql_fetch_assoc($result)) {
    echo $row['user_email'].',';
    }
    }
    ?>

    http://www.studioreflections.com/ausrmusings/

  8. Michael Torbert
    WordPress Virtuoso
    Posted 6 years ago #

  9. ausrmusings
    Member
    Posted 6 years ago #

    Ya, I just looked in the mirror, it's called a blonde moment *grins*. Thanks so much for your help! :)

  10. Michael Torbert
    WordPress Virtuoso
    Posted 6 years ago #

    No problem, I assume you just typed the wrong URL. Keep in mind, this will only show up to the 300th record, since that is what you said you had. If you need more, replace the 300 with something higher than 300.
    If you need more help, feel free to email me.

  11. ausrmusings
    Member
    Posted 6 years ago #

    I did a screencapture of all you said so that I don't forget anything! And, I'm jotting down your eMail addy, thank-you!

    Paula

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.