So. I am using a plugin called "simple user rank" which counts the number of comments and displays a different rank. All good. But I don't want my admins/moderators to be displayed as newbies/rookies or any other rank just because they don't comment that much.
This is how the plugin works and displays the rank
if( !function_exists('get_user_rank') ) {
function get_user_rank()
{
if( !$ranks = get_option('_user_rank_comments_fields') ) return false;
$count = get_transient( 'user_rank_comments_' . substr(md5( strtolower(get_comment_author_email( $comment_id )) ),0, );
if ( false === $count ) {
global $wpdb;
$count = $wpdb->get_var( $wpdb->prepare( 'SELECT COUNT(comment_ID)
FROM ' . $wpdb->comments. '
WHERE comment_author_email = %s
AND comment_approved = 1'
,
get_comment_author_email()
)
);
set_transient( 'user_rank_comments_' . substr(md5( strtolower(get_comment_author_email( $comment_id )) ),0,, $count );
}
foreach( $ranks as $row ) {
if( $count >= (int)$row['count'] )
$rank = $row['name'];
else break;
}
return $rank;
I want to override the rank displayed for admin and/or moderator like this:
if (current_user_can( 'manage_options' )) {
echo 'admin'
}
elseif (current_user_can( 'moderate_comments' )) {
echo 'moderator'
}
endif return $rank
Any help is appreciated! Thanks!