• Resolved woeterman_94

    (@woeterman_94)


    Please add role support. Not every user (editors etc..) on my dashboard needs to be able to see the logs!!!!

    Allow the logs to be only visible to site admins

Viewing 1 replies (of 1 total)
  • Plugin Author P?r Thernstr?m

    (@eskapism)

    You can configure who can see the log by using some filters.

    For example:

    
    /**
     * Change capability required to view main simple history page.
     * Default capability is "edit_pages". Change to for example "manage options"
     * to only allow admins to view the history log.
     */
    add_filter('simple_history/view_history_capability', function( $capability ) {
    	$capability = 'manage_options';
    	return $capability;
    });
    

    or

    
    // Allow only the users specified in $allowed_users to show the history page, the history widget on the dashboard, or the history settings page
    add_filter( 'simple_history/show_dashboard_page', 'function_show_history_dashboard_or_page' );
    add_filter( 'simple_history/show_dashboard_widget', 'function_show_history_dashboard_or_page' );
    add_filter( 'simple_history/show_settings_page', 'function_show_history_dashboard_or_page' );
    function function_show_history_dashboard_or_page( $show ) {
    	$allowed_users = array(
    		'[email protected]',
    		'[email protected]',
    	);
    	$user = wp_get_current_user();
    	if ( ! in_array( $user->user_email, $allowed_users ) ) {
    		$show = false;
    	}
    	return $show;
    }
    

    Check the examples file, it may contain even more examples:
    https://github.com/bonny/WordPress-Simple-History/blob/master/examples/examples.php

Viewing 1 replies (of 1 total)
  • The topic ‘Support for roles?’ is closed to new replies.