bbPress Advanced Statistics Notice
-
I was running a Query Monitor on my site and noted the following:
Undefined index: latest-user
wp-content/plugins/bbpress-improved-statistics-users-online/includes/public/class.online.php:229 bbPress_Advanced_Statistics_Online->allowed_tags()
So I had a look at the core file at that line and found:
private function allowed_tags() { // Store all of the strings currently replace $this->_tags = array( "%MINS%" => $this->parent->option['user_inactivity_time'], "%COUNT_ACTIVE_USERS%" => $this->stats["count"]["active"], "%HOURS%" => $this->parent->option['user_activity_time'], "%COUNT_ALL_USERS%" => $this->stats["count"]["inactive"] - $this->stats["count"]["guests"], "%COUNT_ALL_GUSERS%" => $this->stats["count"]["guests"], "%COUNT_ACTIVE_GUSERS%" => $this->stats["count"]["guestsa"], "%USER_USERS%" => _n("user", "users", $this->stats["count"]["active"], 'bbpress-improved-statistics-users-online'), "%GUEST_GUESTS%" => _n("guest", "guests", $this->stats["count"]["guestsa"], 'bbpress-improved-statistics-users-online'), "%ALL_USER_USERS%" => _n("user", "users", $this->stats["count"]["inactive"] - $this->stats["count"]["guests"], 'bbpress-improved-statistics-users-online'), "%ALL_GUEST_GUESTS%" => _n("guest", "guests", $this->stats["count"]["guests"], 'bbpress-improved-statistics-users-online'), "%USER_RECORD%" => $this->most_users( "record" ), "%USER_RECORD_DATE%" => $this->most_users( "date" ), "%USER_RECORD_TIME%" => $this->most_users( "time" ), "%LATEST_USER%" => $this->stats["latest-user"] );
The offender is:
"%LATEST_USER%" => $this->stats["latest-user"]
So I tried to find where
latest-user
is also used and only found one place in all the files, here:private function stats_extra( $activity ) { if( $this->parent->option["bbpress_statistics"] == "on" ) { // Add the bbPress Statistics $activity["bbpress"] = $this->get_formatted_statistics(); } if( $this->parent->option["last_user"] == "on" ) { // Get the HTML latest usser $activity["latest-user"] = $this->get_latestuser( true ); } if( $this->parent->option["most_users_online"] == "on" ) { // Get/set the most users ever online, users the active online users $activity["most-users"] = $this->get_mostusers( $activity["count"]["active"] ); } return $activity; }
This led me to:
// Create the statistics variable $this->stats = $this->stats_extra( $activity );
So this warning looks like a false positive to me. Thoughts?
- You must be logged in to reply to this topic.