Support Forum
There is no option to do allow for it bu a simopel filter can do the trick.
See this post: https://simple-press.com/suppo.....t/#p163700
This guy wanted to show moderators in the top posters. All you need to do to show admins is remove the bit in the code where it says 'AND admins=0'. Like this:
add_filter('sph_top_poster_stats_query', 'add_mods'); function add_mods($query) { $query->where = 'hide_stats = 0 AND posts > -1'; return $query; }
All you need to do is part 2 of that post. Part 1 is already in the plugin core
YELLOW
SWORDFISH
|
Thanks for the response.
Here is what sp-user-functions.php looks like
<?php
add_filter('sph_top_poster_stats_query', 'add_mods');
function add_mods($query) {
$query->where = 'hide_stats = 0 AND posts > -1';
return $query;
}
?>
And starting at line 272 of sp-db-statistics.php
function sp_get_top_poster_stats($count) {
$spdb = new spdbComplex;$spdb->found_rows = true;
$spdb->table = SFMEMBERS;
$spdb->fields = SFMEMBERS.'.user_id, display_name, posts';
$spdb->join = array(
SFMEMBERSHIPS.' ON '.SFMEMBERS.'.user_id = '.SFMEMBERSHIPS.'.user_id',
SFUSERGROUPS.' ON '.SFMEMBERSHIPS.'.usergroup_id = '.SFUSERGROUPS.'.usergroup_id');
$spdb->where = 'hide_stats = 0 AND posts > -1';
$spdb->groupby = SFMEMBERS.'.user_id';
$spdb->orderby = 'hide_stats ASC, posts DESC';
$spdb->limits = "0, $count";$topPosters = $spdb->select();
return $topPosters;
I've run the cron but it is still not showing up.
Thought I followed it pretty close but maybe not.
Stang
Putting it back in I get the following at the top of the page:
erid, 'lastvisit', 0); } ?>
3
Warning: Cannot modify header information - headers already sent by (output started at /home/obmcsalt/public_html/wp-content/plugins/simple-press/forum/database/sp-db-statistics.php:412) in /home/obmcsalt/public_html/wp-content/plugins/wp-super-cache/wp-cache-phase2.php on line 62
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/obmcsalt/public_html/wp-content/plugins/simple-press/forum/database/sp-db-statistics.php:412) in /home/obmcsalt/public_html/wp-content/plugins/wp-embed-facebook/lib/class-wp-embed-fb-plugin.php on line 221
This also causes my signature to show back up (we're talking about this in another post)
I was just checking as you posted. Seems I was wrong. The filter has not yet gone into the core code because that post and request was made since the last update and the filter is still waiting to be released so my apologies, but you DO need to do part one of that old post as well.
And those error message suggest you have made an error in the coding,
For the record here is the entire function as it should be:
$spdb = new spdbComplex;
$spdb->found_rows = true;
$spdb->table = SFMEMBERS;
$spdb->fields = SFMEMBERS.'.user_id, display_name, posts';
$spdb->join = array(
SFMEMBERSHIPS.' ON '.SFMEMBERS.'.user_id = '.SFMEMBERSHIPS.'.user_id',
SFUSERGROUPS.' ON '.SFMEMBERSHIPS.'.usergroup_id = '.SFUSERGROUPS.'.usergroup_id');
$spdb->where = 'hide_stats = 0 AND admin=0 AND moderator=0 AND posts > -1';
$spdb->groupby = SFMEMBERS.'.user_id';
$spdb->orderby = 'hide_stats ASC, posts DESC';
$spdb->limits = "0, $count";
$spdb = apply_filters('sph_top_poster_stats_query', $spdb);
$topPosters = $spdb->select();
return $topPosters;
}
YELLOW
SWORDFISH
|
No problem at all confusion happens. 🙂
OK, so here is what my sp-user-functions.php looks like:
<?php
add_filter('sph_top_poster_stats_query', 'add_mods');
function add_mods($query) {
$query->where = 'hide_stats = 0 AND posts > -1';
return $query;
}
?>
And from sp-db-statistics.php I have this:
function sp_get_top_poster_stats($count) {
$spdb = new spdbComplex;
$spdb->found_rows = true;
$spdb->table = SFMEMBERS;
$spdb->fields = SFMEMBERS.'.user_id, display_name, posts';
$spdb->join = array(
SFMEMBERSHIPS.' ON '.SFMEMBERS.'.user_id = '.SFMEMBERSHIPS.'.user_id',
SFUSERGROUPS.' ON '.SFMEMBERSHIPS.'.usergroup_id = '.SFUSERGROUPS.'.usergroup_id');
$spdb->where = 'hide_stats = 0 AND moderator=0 AND posts > -1';
$spdb->groupby = SFMEMBERS.’.user_id’;
$spdb->orderby = 'hide_stats ASC, posts DESC';
$spdb->limits = "0, $count";
$spdb = apply_filters(‘sph_top_poster_stats_query’, $spdb);
$topPosters = $spdb->select();
return $topPosters;
}
I have nothing showing up under my Top Posters yet so I'm wondering did I miss something here that you can see? I did run my chron but still no change.
Thank you!
Stang
1 Guest(s)