[resolved] Multisite list users (4 posts)

  1. publicradio
    Posted 5 years ago #


    I am looking for a way to have, on my main blog a directory of all users on the other blogs. It would go like this:


    -Blog 1

    ---(list out admins)

    ---(list out contributors


    -Blog 2

    ---(list out admins)

    ---(list out contributors

    Could someone point me in the right direction on this? Thanks so much.

  2. http://wordpress.org/extend/plugins/members-list/ would be it for per-site users, I think.

    You'd have to extend that to all sites somehow.

  3. Custom. very very custom work. :)

    Go get blog 1 details, pull list of users. go get blog 2 details, pull list of users.

    Cache results so it's not looping thru every blog on every load of this page.

  4. publicradio
    Posted 5 years ago #

    Here's a function I wrote that works

    function rolodex($blognumber,$content = null) {
          extract(shortcode_atts(array( "blognumber" => 'blognumber' ), $blognumber));
          $rolodex = '<a name="'.$content.'"></a><table class="full"><caption>'.$content.'</caption>
          <thead><th> </th>
          <th nowrap="nowrap">First Name</th>
          <th>Last Name</th>
          <th>Phone number</th>
          <th>Emergency contact</th>
          <th>Emergency phone</th>
        $blogusers = get_users('blog_id='.$blognumber.'&orderby=nicename&role=author');
        foreach ($blogusers as $user) {
          $rolodex .= '<tr>';
          $userdat = get_userdata($user->ID);
          $rolodex .= '<td>'.get_avatar($user->ID,52).'</td>';
          $rolodex .= '<td>'.$userdat->first_name .'</td>';
          $rolodex .= '<td>'.$userdat->last_name.'</td>';
          $rolodex .= '<td nowrap="nowrap">'.$userdat->phonenumber.'</td>';
          $rolodex .= '<td><a href="mailto:'.$user->user_email.'">'.$user->user_email.'</a></td>';
          $rolodex .= '<td>'.$userdat->{'911contact'}.'</td>';
          $rolodex .= '<td>'.$userdat->{'911phonenumber'}.'</td>';
          $rolodex .= '</tr>';
          $rolodex .= '</tbody>';
          $rolodex .= '</table>';
          return $rolodex;
      add_shortcode('rolodex', 'rolodex');

    With this you go into a page and add [rolodex blognumber="2"]First Blog[/rolodex] and it spits out a directory.

Topic Closed

This topic has been closed to new replies.

About this Topic