Support Forum
Hi guys,
Curious whether it is possible to have the Member Stats not include free subscribers?
Right now my member count of 695 includes free subscribers.
So out of the total of 695 only around 550 are paying members.
It would be great to have the member count display 550 instead of 695.
Thanks for any insight,
Ryan
you will have to adjust the stats query... so use the filter for the query... sph_stats_members_count_query
something like:
add_filter('sph_stats_members_count_query', 'my_stats_query');
function my_stats_query($spdb) {
# adjust our query here in $spdb
# $spdb->where =
return $spdb;
}
you just need to replace our query with yours... in the comments, I suggested adding a mysql where clause to exclude free subscribers... cannot be more specific because I do not know how those users are identified...
Visit Cruise Talk Central and Mr Papa's World
As I said, I would need more info from you... I have not idea what free subscribers means on your site... its not a standard wp term or condition... so I dont know how to identify those users on your site... with it, I could clarify the where clause...
the filter can go in your spFunctions.php template file...
Visit Cruise Talk Central and Mr Papa's World
I understand. Here's a screen shot of my Wordpress user interface (maybe this will help?)
You'll see the "Subscriber" - there are 136 of them. These are the people I'd like to exclude from the member count.
Does this help you identify the users I would like to exclude?
Let me know when you can - much appreciated!
How do these particular users relate in Simple:Press User Group terms? Trying to get the WordPress role to join in the SQL query is not that comfortable a task because of the terrible data storage WordPress employs for this information... It also needs php code to establish the data - it can not be accomplished with a sytraight query.
So you really need something else to be able to identify them with - like User Groups. If not that - are you using a membership plugin of some sort? Might that have the necessary data that could be used?
YELLOW
SWORDFISH
|
I'm currently using the s2member membership site plugin.
I like the idea of using User Groups.
What I just did using "Map Users To User Group" is assign the default user group for subscribers to Guests
Then I checked the bubble next to "Users Are Limited to Single User Group Membership" (see below)
I thought this may extract the subscribers from the member count in the forum, however as of right now the member count has remained unaffected and still includes the subscribers...
I feel I am on the right track and appreciate any insight you may have for me. Thanks!
well, that would be a bit odd... assigning actual users to the guest usergroup would really just affect permissions... they would still be members... probably better to create a different usergroup and give them the permissions you want so the other member/guest checks would work as expected...
still, assuming everyone you wanted to count was in a usergroup, you could probably use this to adjust the counts:
add_filter('sph_stats_members_count_query', 'my_stats_query'); function my_stats_query($spdb) { $spdb->join = array(SFMEMBERSHIPS.' ON '.SFMEMBERSHIPS.'.user_id = '.SFMEMBERS.'.user_id'); $spdb->fields = 'COUNT(DISTINCT '.SFMEMBERS.'.user_id) AS count'; $spdb->where = SFMEMBERSHIPS.'.usergroup_id != 1'; return $spdb; }
the usergoup_id != 1 would just need to be updated with the sp usergroup you wanted to exclude...
think it will work, but have not tested and could give odd results depending on how users and memberships were handled... but give it a try...
Visit Cruise Talk Central and Mr Papa's World
Top or bottom - doesn't really matter as long as:
- It is between the opening php tag at the top of the file and the closing php tag at the bottom.
- After or before any existing functions in the file.
- You do not create any extra whitespace (empty lines) after the closing php tag at the bottom of the file.
YELLOW
SWORDFISH
|
1 Guest(s)