The MU forums have moved to WordPress.org

Email all users - any recent developments? (8 posts)

  1. josswinn
    Member
    Posted 13 years ago #

    Hello,

    I'm looking for a way to mass email all users that have Wordpress MU blogs on our server. The forum archives show that there were a couple of attempts a year or two ago, but nothing recent and working. Does anyone know of a plugin or hack that works? There's a plugin for the single user Wordpress but I don't think it works beyond emailing registered users of a single blog.

    Thanks for any help
    Joss

  2. MrBrian
    Member
    Posted 13 years ago #

    There's a premium plugin already available,
    http://premium.wpmudev.org/plugins/

    but i don't think anyone else has cared enough to code and release. You're welcome to.

  3. josswinn
    Member
    Posted 13 years ago #

    OK. Thanks. If I knew where to start with coding plugins, I would give it a try. :-)

  4. jamescollins
    Member
    Posted 13 years ago #

    Although this doesn't do the actual email sending, I've just created the following mu-plugin that will list all email addresses that are administrators of one or more blogs on your WPMU installation:

    <?php
    add_action('admin_menu', 'list_emails_all_add_menu');
    
    function list_emails_all_add_menu()
    {
    	if (is_site_admin())
    	{
    		add_submenu_page('wpmu-admin.php', 'Email All', 'Email All', 10, 'email_all', 'list_emails_all_page');
    	}
    }
    
    function list_emails_all_page()
    {
    
    ?>
    <div class='wrap'>
    <h2>Email All</h2>
    <p>Following is a list of email addresses that are administrators of one or more blogs on this WPMU installation.</p>
    <pre>
    <?php
    global $wpdb;
    $query = "SELECT DISTINCT (u.user_email)
    FROM <code>$wpdb->usermeta</code> m INNER JOIN <code>$wpdb->users</code> u on m.user_id=u.id
    WHERE meta_key like 'wp_%_user_level' and meta_value='10'
    ORDER by 1";
    
    $emails = $wpdb->get_results($query);
    
    foreach ($emails as $e) {
    	echo "$e->user_email, \n";
    }
    ?>
    </pre>
    <?php
    }
    ?>

    Add the above code to a new php file in wp-content/mu-pluings/, then visit Dashboard -> Site Admin -> Email All

    to obtain a comma separated list of emails.

    You can then paste the list of emails into the BCC field in your email client.

  5. dsader
    Member
    Posted 13 years ago #

    Thank you jamescollins.(after deleting <code></code> tags from query)

  6. jamescollins
    Member
    Posted 13 years ago #

    Glad it was useful dsader. I'm not sure why the code tags were added - they weren't in the PHP code I pasted into my post.

  7. eswhite
    Member
    Posted 13 years ago #

    Thank you jamescollins!

    I was just searching the forums for this and was thrilled to find something that works!

  8. dfjones
    Member
    Posted 13 years ago #

    Thanks jamescollins, very useful plugin indeed. Much appreciated.

About this Topic

  • Started 13 years ago by josswinn
  • Latest reply from dfjones