WordPress.org

Ready to get started?Download WordPress

Forums

WP-UserOnline
small bug report (4 posts)

  1. Dan-Lucian Stefancu
    Member
    Posted 2 years ago #

    in wp-useronline.php:50 $most variable gets the default 'date' value as a timestamp, but the option reads a mysql time, and later on template-tags.php:40 get_most_users_online_date does not convert the option.

    changes needed:

    wp-useronline.php:50

    $most = new scbOptions( 'useronline_most', __FILE__, array(
    	'count' => 1,
    	'date' => current_time( 'mysql' )
    ) );

    template-tags.php:40

    function get_most_users_online_date() {
    	return UserOnline_Template::format_date( UserOnline_Core::$most->date, true );
    }

    http://wordpress.org/extend/plugins/wp-useronline/

  2. scribu
    Member
    Plugin Author

    Posted 2 years ago #

    Yes, the date is stored as a timestamp, but it is converted when necessary.

    Relevant lines:

    core.php:

    // Maybe Update Most User Online
    		if ( self::$useronline > self::$most->count ) {
    			self::$most->update( array(
    				'count' => self::$useronline,
    				'date' => current_time( 'timestamp' )
    			) );
    		}

    template-tags.php:

    function get_most_users_online_date() {
    	return UserOnline_Template::format_date( UserOnline_Core::$most->date );
    }

    So, I'm not sure what the problem is.

    PS: If the issue is that it's called 'date' when it's actually a timestamp, I agree that it's misleading.

    That said, it's not worth it to change to a mysql date string, since it would also require some code to upgrade the existing data when users update the plugin.

  3. Dan-Lucian Stefancu
    Member
    Posted 2 years ago #

    On a site I've got January 1, 1970 as date for most users online, because the option is stored in the database in mysql format, and it's also trowing a php notice.

    Maybe it's a bug for old installs only. On a newer install I've got the date stored as timstamp in the database.

  4. scribu
    Member
    Plugin Author

    Posted 2 years ago #

    Yeah, deleting the option will probably fix it.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic