Jump to content
Sign in to follow this  
basmati

remove admin menu items for some users - with a hook

Recommended Posts

basmati

Hi Folks, i'd like to remove the Platform Admin Menu Link for some users - to prevent them from changing important parts of a project. I found this hook - its easy to hide admin links like Plugins, Comments - and it works great in functions.php. But Unfortunately the Pageline Admin Link won't disappear. Any suggestions? Thanks for any ideas! Here's the code: function remove_menus() { global $menu; global $current_user; get_currentuserinfo(); if($current_user->user_login == 'the-user-name') { $restricted = array(__('Posts'), __('Comments'), __('Plugins'), __('Pagelines'), ); end ($menu); while (prev($menu)){ $value = explode(' ',$menu[key($menu)][0]); if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);} }// end while }// end if } add_action('admin_menu', 'remove_menus');

Share this post


Link to post
Share on other sites
Simon
[code] function remove_pp_menu() { global $menu; foreach( $menu as $key => $item ) { if ( $item[0] == 'PlatformPro') unset( $menu[$key]); } } add_action('admin_head', 'remove_pp_menu'); [/code] Completely removes platforms admin menu. You may wish to add a user check clause.

Share this post


Link to post
Share on other sites
basmati
Hide Pagelines Menus for special users (change: "my_user_name" to your personal needs). Use this hook in the functions.php of the base theme within platformpro theme. [code]// additional admin Pagelines Hook function remove_pp_menu() { global $menu; global $current_user; get_currentuserinfo(); if($current_user->user_login == 'my_user_name') { foreach( $menu as $key => $item ) { if ( $item[0] == 'PlatformPro') unset( $menu[$key]); } } } add_action('admin_head', 'remove_pp_menu');[/code]

Share this post


Link to post
Share on other sites
basmati
one more question for a hook: How can i hide Pagelines Meta Settings by default?

Share this post


Link to post
Share on other sites
basmati
edit: found a css based solution only: [code]// Screen options add_action( 'admin_head', 'remove_wordpress_cfields' ); function remove_wordpress_cfields() { echo ''; echo ''; } [/code]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×