WordPress.org

Ready to get started?Download WordPress

Forums

StatComm (StatPress Community) Multisite Edition
[resolved] Also collect data about logged users, except for admin? (4 posts)

  1. jardokraka
    Member
    Posted 1 year ago #

    Thank you for your work on this plugin.

    Is there a way I could collect data about logged users except admin? Or, as a workaround, at least not collect data from my IP, and log everyone else including logged-in users?

    At the moment it's either unlogged only, or unlogged + logged, but the latter results in the script logging my own visits as well of which there're lots, and seeing my own visits in the logs is useless.

    Thanks!

    http://wordpress.org/extend/plugins/statpress-community-formerly-statcomm/

  2. WPReady
    Member
    Plugin Author

    Posted 1 year ago #

    Hi jardokraka,
    that is an interesting question.

    The plugin has a filter named statcomm_preinsert you can use it to stop recording under several conditions. It has one parameter with all information available prior saving to the database. If you return an empty string from the filter, the record is skipped.

    This example should do what you're looking for. Please add the following code in the functions.php file under your current theme:

    add_filter('statcomm_preinsert','do_not_log_admin');
    function do_not_log_admin($scu) {
       if ($scu->getUser() =="admin"){ //avoid logging from admin user
          return "";
       }
       return $scu; //no changes
    }

    remember to put the proper admin or user name you want to skip.

  3. jardokraka
    Member
    Posted 1 year ago #

    This worked great, thank you very much.

  4. WPReady
    Member
    Plugin Author

    Posted 1 year ago #

    I'm glad you make it work!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.