Support Forum

Mods posts are included in top posters

DE Dre Erwin
Dre Erwin
Member

Is there any way we can include them..I would like everyone in the list but admins and mods are not

 

thanks

3 Answers

New Answer

YS Yellow Swordfish
Yellow Swordfish
Member

No option to allow it but it can be done with a WP style filter on the query if you are able and interested…

YS Yellow Swordfish
Yellow Swordfish
Member

The filter (named ‘sph_stats_top_posters_query’) would allow you to change the SQL being used for the query. This currently looks like this:

SELECT SQL_CALC_FOUND_ROWS user_id, display_name, posts, admin, moderator FROM XX_sfmembers WHERE admin=0 AND moderator=0 AND posts > -1 ORDER BY posts DESC LIMIT 0, Z

where XX is your WP table prefix and Z is the number of posters to display (set in your options). So something like the code below placed in your SP theme functions.php file which just removes the moderator clause should do the trick…

add_filter('sph_stats_top_posters_query', 'remove_mod');
function remove_mod($sql) {
    $sql = 'SELECT SQL_CALC_FOUND_ROWS 
            user_id, display_name, posts, admin, moderator 
            FROM XX_sfmembers WHERE admin=0 AND posts > -1 
            ORDER BY posts DESC LIMIT 0, Z'
    return $sql;
}

Remember if you try this, that this data is cached and will only refresh once an hour (by default). As always we recommend that you create your own SP theme so that any customisation is not lost during a future update. (http://codex.simple-press.com/codex/themes/theme-basics/creating-a-theme/)