WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How do I hack the Stats plugin? (3 posts)

  1. pad
    Member
    Posted 6 years ago #

    My blog is all about user registrations, and I've just found out that WP.com Stats ignores ANY logged in user. I thought it was just the admin.

    There must be a way to edit the plugin's code to make it detect any logged in user that isn't the admin? Right?

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    I've reported this problem to them before, but they never seem to get around to fixing it... Annoying, I know.

    Find this code:

    if ( !empty($current_user->ID) || empty($options['blog_id']) )
    	return;

    Change it to this:

    if ( current_user_can('manage_options') || empty($options['blog_id']) )
    	return;

    This will make it only ignore users who have the "manage_options" capability, which is generally only administrators.

  3. pad
    Member
    Posted 6 years ago #

    Many, many thanks Otto.

Topic Closed

This topic has been closed to new replies.

About this Topic