AnsPress 4 : Is it possible to add a shortcut or widget to see users with highest reputation?

4.55K viewsUpdates
1

I was looking for a way to show off our best users but can’t find a way to display them. Is this coming soon?

commented
1

I’m not sure specifically about version 4, but i’ve done it before with an sql query like so…

<?php

$sql = <<<HERE
SELECT `user_id`, `meta_value` FROM wp_usermeta 
WHERE wp_usermeta.meta_key = 'ap_reputation' AND wp_usermeta.meta_value > 0 
ORDER BY CAST(meta_value AS int) DESC LIMIT 30
HERE;

$posts = $wpdb->get_results($sql);

foreach ($posts as $k => $info){
echo $info->user_id . ' has ' . $info->meta_value . ' rep';
}

You are viewing 1 out of 1 answers, click here to view all answers.