Support » Networking WordPress » Select all users who are members of any of the blogs for which I am registered

  • Hi,

    I’m trying to populate a list with the email addresses of ALL users who are registered for ANY of the blogs for which the current user is registered.

    I’d like to do this in the most efficient way possible, which I think would be a join. My outline:

    1. Run get_blogs_of_user() http://codex.wordpress.org/WPMU_Functions/get_blogs_of_user to get an array of objects representing the blogs for which the current user is registered.

    2. Do the necessary handling to convert this into the proper WHERE ... OR ... OR query string.

    3a. Run a join to…

    SELECT user_email
    FROM wp_users
    WHERE ...

    Ah, I’m falling apart there. In general…

    consult the wp_blogs table to get the domain of the blogs for which I am registered
    consult the wp_signups table to get all the users of each of those blogs
    consult the wp_users table to get the emails of all of those users

    Can anyone help me flesh that out?

  • The topic ‘Select all users who are members of any of the blogs for which I am registered’ is closed to new replies.