Admin Menu
-
Thanks for this plugin !
I would like to hide admin menu for non admin users… I have try
remove_submenu_page( 'users.php?page=jr_ps_settings' );
and more without success. Any ideas are welcome : )
-
I’ll be back in the office within 3 hours where I need to test to answer your question.
Do you wish to hide the Profile pages of Admin where the User can change his/her password, and add info about him/herself?
If you can live with the User seeing their Profile and a really minimal Dashboard, then you could assign a Role of Subscriber to each non-Admin User, and WordPress will do it all for you.
I also want to be sure that you are aware of the Landing Location setting that the plugin provides. For example, setting Where to after Login? to Go to Site Home. Then, a user would have to type site.com/wp-admin to get to the Admin panels.
Let me know if these ideas are enough. If not, I’ll be glad to discuss it further.
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_menuCheers
Now I understand!
Be back soon with a solution (or two).
Thought about it, took a look at the relevant code in the plugin, and looked at what you are doing. My preference would be to include another checkbox setting on the plugin’s Settings page that determines whether the plugin’s Settings page is an entry in the Users menu.
As for your function.php code, I haven’t tested it, but the Codex says that remove_submenu_page() requires a second parameter.
Please let me know if you would like the new Setting to be added to the plugin.
I’d love to have this new setting available in your plugin : )
Thanks again and again !!!!Version 2.10 is now available to address this need.
It took longer than usual because of odd issues on the Settings page, but they seem to be fully resolved now.
For security reasons, the new Setting can only be modified from the Settings page that is a submenu of the Settings menu in the WordPress Admin menus. It would not make sense to allow someone from the Users submenu to change their own access.
The topic ‘Admin Menu’ is closed to new replies.