Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
general-topic
Display Admin under Top Posters?
Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Nov 22, 2016 - 5:40 pm

Hold on... There may be more to this. It might not be quite as easy as that. I am investigating...

andy-signature.png
YELLOW
SWORDFISH
Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Nov 22, 2016 - 5:56 pm

No - this is going to need more than this. Sorry. I was overlooking the fact that admins do not belong to user groups. I think I have an answer for you but I need to do a little more research and testing. Afraid it might be tomorrow morning now before I can confirm but if I can work it out tonight I will.

The stumbling block is that the forum admin (i.e., you) can set a user group to NOT be included in the stats. If you want to use that facility then I don't think we can do what you want with the top posters list. If you are NOT going to use that option then we can.

andy-signature.png
YELLOW
SWORDFISH
Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Nov 23, 2016 - 4:53 am

Right - this works as long as (see above) you are happy to sacrifice the 'hide stats' option for user groups. Below is the code you need to out into the user file to replace what we did before.

add_filter('sph_top_poster_stats_query', 'add_mods');
function add_mods($query) {
    $query->join = '';
    $query->left_join = array(
 SFMEMBERSHIPS.' ON '.SFMEMBERS.'.user_id = '.SFMEMBERSHIPS.'.user_id',
 SFUSERGROUPS.' ON '.SFMEMBERSHIPS.'.usergroup_id = '.SFUSERGROUPS.'.usergroup_id');
    $query->where = 'posts > -1';
    $query->orderby = 'posts DESC';
return $query;
}

Note - it is better copy from the 'raw Code' popup and then paste into the code text file. In particular note that this part - $query->join = '';  - is not a double quote but two single quotes with no space.

andy-signature.png
YELLOW
SWORDFISH
Avatar
Stang5_0
Member
sp_UserOfflineSmall Offline
Nov 23, 2016 - 11:38 am

Still no luck.

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Nov 23, 2016 - 11:55 am

I can confirm that this code does work. In fact I still have it active on my development system here. So - did you check the error log as described earlier?

andy-signature.png
YELLOW
SWORDFISH
Avatar
Stang5_0
Member
sp_UserOfflineSmall Offline
Nov 23, 2016 - 2:11 pm

Yes just cleared and checked and it reports

There are no Error Log Entries

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Nov 23, 2016 - 3:59 pm

I am going to have to give this some time for thought as at the moment I can see no possible reason for it not to display. I will ask a colleague if they can think of anything as well.

andy-signature.png
YELLOW
SWORDFISH
Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Nov 27, 2016 - 11:54 am

the query looks right and quick test does as well...

Are you stats updating currently?  perhaps wp cron is having an issue and the stats are not even updating?

Avatar
Stang5_0
Member
sp_UserOfflineSmall Offline
Dec 6, 2016 - 1:04 pm

Hi there Mr Papa

Yes, just did a test post and the stats updated by 1.

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Dec 6, 2016 - 2:58 pm

Do we have a link to your forum page? Can we have one?

andy-signature.png
YELLOW
SWORDFISH
Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 619
Members: 17362
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10127
Posts: 79625