Skip to:
Content
Pages
Categories
Search
Top
Bottom

List of buddypress members with most posts.


  • enderpal444
    Participant

    @enderpal444

    Im trying to use this code I found that calls a list of the authors with most posts. It used the name of the author though and I just want to show the buddypress avatar but I cant get anything to work. Here’s the code.

    $order = ‘postcount';
    $limit = ‘5’;
    $usersinfo = $wpdb->get_results(“SELECT $wpdb->users.ID as ID, COUNT(post_author) as postcount FROM $wpdb->users LEFT JOIN $wpdb->posts ON $wpdb->users.ID = $wpdb->posts.post_author WHERE post_type = ‘post’ GROUP BY post_author ORDER BY $order DESC LIMIT $limit”);
    foreach($usersinfo as $userinfo) : // start authors’ profile “loop”
    $user = get_userdata($userinfo->ID);
    $user->postcount = $userinfo->postcount;
  • The topic ‘List of buddypress members with most posts.’ is closed to new replies.
Skip to toolbar