How to list users by rating?

6.06K viewsCoretop list
0

Hello,

I want top list TOP 5 users for their ratings. How can I do it?

For example I use to list TOP 5 users by their post count this code:

<?php
global $wpdb;

$top_authors = $wpdb->get_results("

    SELECT u.ID, count(post_author) as posts FROM {$wpdb->posts} as p

    LEFT JOIN {$wpdb->users} as u ON p.post_author = u.ID

    WHERE p.post_status = ‘publish’

    AND p.post_type = ‘post’

    GROUP by p.post_author

    ORDER by posts DESC

    LIMIT 0,5

    ");

if( !empty( $top_authors ) ) {

    echo '<ul style="text-align: center;">';

    foreach( $top_authors as $key => $author ) {

        echo get_avatar( $author->ID , 45 ) . '<li style="margin-bottom: 15px;"><a href="' . get_author_posts_url( $author->ID ) . '" style="text-decoration: none;color: rgb(54, 116, 157);text-transform: capitalize;font-weight: 600;font-size: 16px;">' . get_the_author_meta( 'user_nicename' , $author->ID ) . '</a></li>';

    }

    echo '</ul>';

}

?>
0

how can i use userlist show?

0

Widget already exists, AP Users widget. You can show a list of users sorting by reputation.

From where I can find this widget? I don’t see it in my widgets.

my mistake, its in AnswerBox theme. I will add it to current roadmap

Ok. I have doubts about roadmap. Its features looks perfect but I afraid of that it will conflict with my buddypress. There will be 2 notification and 2 activity at the same time.

AnsPress profile can be disabled if you want to use buddyPress. I have already answered it http://anspress.io/how-to-disable-anspress-user-profile/

It was what I need thanks! Also I wait more compatibility with buddypress 🙂