Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter akiprod

    (@100tral)

    I’d love to have this new setting available in your plugin : )
    Thanks again and again !!!!

    Thread Starter akiprod

    (@100tral)

    Thanks for your reply !
    We can manage your plugin preferences from 2 sections:
    1. Settings (/wp-admin/options-general.php?page=jr_ps_settings)
    2. Users (/wp-admin/users.php?page=jr_ps_settings)
    I would like to hide your plugin preferences from the USERS submenu to prevent any other admin user to change config.
    My function.php is :

    /* —————————————————————————————————————————————————————————————————————————————————————
    	 * 	REMOVE ADMIN MENU ITEMS based on username
    	 * ————————————————————————————————————————————————————————————————————————————————————— */
    		if (!function_exists('remove_admin_menu')):
    		function remove_admin_menu()
    	{
    
    	    // provide a list of usernames who can edit custom field definitions here
    	    $admins = array(
    	        'user1',
    	        'user2'
    	    );
    
    	    // get the current user
    	    $current_user = wp_get_current_user();
    
    	    // match and remove if needed
    	    if( !in_array( $current_user->user_login, $admins ) )
    		{
    
    				remove_menu_page('plugins.php'); // Plugins
    				remove_menu_page('tools.php'); // Tools
    				remove_menu_page('options-general.php'); // Settings
    				// Remove Plugins
    				remove_menu_page('edit.php?post_type=acf'); //ACF
    				remove_menu_page('wpcf7'); //WP ContactForm7
    				remove_submenu_page('users.php?page=jr_ps_settings'); //jonradio Private Site
    
    	    }
    
    	}
    		add_action( 'admin_menu', 'remove_admin_menu', 999);
    		endif; // remove_admin_menu

    Cheers

Viewing 2 replies - 1 through 2 (of 2 total)