slshimerdla
Member
Posted 3 years ago #
Okay... what if I WANT it to show users who are logged in? I don't see an option for this anywhere. Is there a way I can change this via code?
I have my blog tied together with my VBulletin forums, and users that are logged in on the forums are automatically bridged over to my WP, so a good chunk of my users WILL be logged in. And, of course, I'll want to count their hits, too.
Thanks!
spockers
Member
Posted 3 years ago #
Ditto. My blog is about my 2-yr-old son, and is for family and friends. Everyone must register to post, so having only anon users' stats isn't very useful. I would think this would be a trivial change, so I'll see if my limited programming skillz are up to it. If I figure it out, I'll post a solution here.
Thanks
spockers
Member
Posted 3 years ago #
OK I think I found it. Go to line 85 in stats.php (I'm using CuteFTP, other editors may differ on line numbering). It should look like this:
if ( !empty($current_user->ID) || empty($options['blog_id']) )
Remove the ! before empty, so it looks like this:
if ( empty($current_user->ID) || empty($options['blog_id']) )
So far it seems to be working. Let me know if it works for you.
This way you only count the registered users, if you change this line:
if ( !empty($current_user->ID) || empty($options['blog_id']) )
for this one:
if ( empty($options['blog_id']) )
it counts everything.
Greets,
Jbrinx
spockers
Member
Posted 3 years ago #
Thanks, JBrinx, that makes more sense, and works for me.
NerdSpawn
Member
Posted 3 years ago #
Thanks for this thread. And thanks for the code change, JBrinx. Made those changes now and am super-happy with the stats now, as my site is mainly for registered users.
One little issue I was wondering if anyone had a solution for...
Does anyone know how to exclude administrator page views from the stats? We've got 2 site admins and I notice that when I'm adding new content, it includes any of my page views. Since I'm using WordPress as a CMS, I'd prefer it not show my own page views to give a more accurate representation of the site traffic.
Thanks in advance for any help offered.
podictionary
Member
Posted 3 years ago #
I'm running a couple of invitation-only blogs using the "members only" plugin so all my visitors are logged in.
I could fiddle the code as suggested above but won't that get washed out every time a new version of the stats plugin is updated?
I see that the "Google Analyticator" plugin has an option not to count administrators. (actually it tracks by "level" admin being 10, I don't know what the other levels are).
Here's a plea to the designers of stats plugin to add similar functionality.
spockers
Member
Posted 3 years ago #
@ podictionary...
Yes, the code change above will get wiped out on updates, I had to hunt this thread again because I got a notice that there's an update to the plugin and I like to stay current. I second your (and NerdSpawn's) plea about the plugin not counting admin users. I'm sure someone out there knows how to do this -- it's surely trivial, so please, someone, jump in!