• Graham

    (@sandgroper)


    I have a site with multiple Authors and needed some way of knowing who was logged in, so I didn’t do any maintenance at that time.

    By using the examples for functions.php I was able to show only that, and only to me. Just what I was looking for.

    Here’s what I used to do that:

    /** Only allow admin to view the history log. */
    add_filter("simple_history/view_history_capability", function($capability) {
        $capability = "manage_options";
        return $capability;
    });
    /** Load only history for the loggers that are specified in the $do_log_us array */
    add_filter("simple_history/logger/load_logger", function($load_logger, $logger_basename) {
    	$load_logger = false;
    	$do_log_us = array("SimpleUserLogger", "SimplePluginLogger", "SimpleLogger");
    	if ( in_array( $logger_basename, $do_log_us ) ) {
    		$load_logger = true;
    	}
    	return $load_logger;
    }, 10, 2 );
    /** Clear history log every 2 days */
    add_filter( "simple_history/db_purge_days_interval", function( $days ) {
    	$days = 2;
    	return $days;
    } );
  • The topic ‘Great Who’s Logged In Plugin’ is closed to new replies.