Support Forum
Hi. If I make someone a moderator, and they were in the Top Posters forum stats, their name disappears from the list.
I know the Moderators have their own list which includes their post counts, but I'd like the option to have them also in the Top Posters list, especially if they're in both the Moderators and and Members user groups.
Is there a way to include forum moderators in the "Top posters" section of the stats panel? If not, can I suggest it becomes an option in General Display Settings?
you can filter the query to include moderators and admins if you like...
use filter: sph_stats_top_posters_query
which returns an object... edit the object where element to remove the admin=0 and moderator=0 part of it...
holler if you need more help..
Visit Cruise Talk Central and Mr Papa's World
holler if you need more help..
Yes please! Could I get some step-by-step instructions? I'm not overly familiar with php, and I don't know where I find that filter.
Also, will changes get overwritten with a SP update or can I put them in a child theme?
to your spFunctions.php file, add this:
add_filter('sph_stats_top_posters_query', 'my_stats_query');
function my_stats_query($query) {
$query->where = 'admin=0 AND posts > -1';
return $query;
}
that will add in moderators now when the stats run... remember, they are cached, so may take an hour to show up...
Visit Cruise Talk Central and Mr Papa's World
Hi again. I added that code to the spFunctions.php file in my child theme. If I manually run the sph_stats_cron hook in Cron Inspector the moderators appear in the Top Posters list.
However, when the cron job runs again at its usual time (every 3600 seconds) it goes back to displaying only standard members, not members and moderators.
Is there something else I need to do to get this working consistently? What is resetting the list?
wouldnt have thought so, but maybe the sp theme isnt loaded by wp cron (which actually makes sense)...
so try moving it to your wp theme functions.php file...
Visit Cruise Talk Central and Mr Papa's World
That's good news. Thanks for the update.
It's an interesting condition you met there. The Cron tasks can be actioned by loading a page from the back or the front end and depending on what is being run will determine whether any SP theme code is loaded or not. We will remember this wrinkle for the future...
YELLOW
SWORDFISH
|
1 Guest(s)