• Resolved cheggindia

    (@cheggindia)


    Is it possible to provide simple history access to specific users with editor roles or in that case any role other than admin?

Viewing 2 replies - 1 through 2 (of 2 total)
  • I remember there is some information around that topic in here (maybe FAQs)

    I am using this code snippet to allow only specific users to access it. Per default every Editor can access Simple History.

    <?php 
    
    // 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' );
    add_filter( 'simple_history/add_admin_bar_menu_item', 'function_show_history_dashboard_or_page' );
    add_filter( 'simple_history/add_admin_bar_network_menu_item', 'function_show_history_dashboard_or_page' );
    
    function function_show_history_dashboard_or_page( $show ) {
        $allowed_users = array(
            'theindividualeditorusername',
        );
    
        $user = wp_get_current_user();
    
        if ( ! in_array( $user->user_login, $allowed_users ) ) {
            $show = false;
        }
    
        return $show;
    }
    
    Plugin Author P?r Thernstr?m

    (@eskapism)

    Thanks for the snippet @markussss!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Access Management’ is closed to new replies.