Archived

This topic is now archived and is closed to further replies.

  • 0

Menu Admin Customise for Pagelines

Question

Posted · Report post

Hey chaps!

 

Im using the following with no issues at all to block these items from 'Username' admin, but allowing my admin to still remain the same.

function remove_menus()
{
    global $menu;
    global $current_user;
    get_currentuserinfo();
    if($current_user->user_login == 'Username')
    {
    
        $restricted = array(__('Links'),
                            __('Pages'),
                            __('Comments'),
                            __('Appearance'),
                            __('Plugins'),
                            __('Users'),
                            __('Tools'),
                            __('Settings')
        );


        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');

 

My question to you guys, is how can I target the pagelines menu items this way, as it doesnt seem to work using __('PageLines') which is what I assumed.  I also need to remove the top nav from 'Username' as well, so that user can see nothing to do with Pagelines.

 

I know there is an option in the front end, but I dont want to limit the other menu items from Admin > Editor, as 'Username" requires some Admin menu items.

 

Thank you muchly guys!

Share this post


Link to post
Share on other sites

5 answers to this question

Posted · Report post

Thanks for your help James, but I have found that some clients require the use of the Widgets section or other sections only available to Admins, which causes issues for me with this method.

Share this post


Link to post
Share on other sites

Posted · Report post

In that case, since Widgets are outside the control of PageLines and part of WordPress, then you'll need a third party plugin to manage the Dashboard.  There are several excellent ones in Wordpress.org.  Try this one: wordpress.org/plugins/dashboard-commander/

 

Customizing code unnecessarily is a sure way of breaking your site, and causing more problems down the road.

Share this post


Link to post
Share on other sites

Posted · Report post

Hi,

 

I'm unsure what you're trying to accomplish using code, but to hide PageLines from the Admin Dashboard, we have a setting in Dashboard > PageLines > Site Options > Advanced which determines the level at which some PL options are visible to your authorized users.

 

Additionally, plugins are available to manage the rest of your dashboard and keep prying eyes (and frisky fingers) from doing unacceptable things to your site.  While many developers dislike plugins, it's important to keep in mind, sometimes customizations can be overwritten by updates.

Share this post


Link to post
Share on other sites

Posted · Report post

I am trying to remove the Pagelines menu item in the same fashion I removed the others, I simply dont know how to target it - I suppose the name or .php file would do the trick :)

 

As I mentioned I am aware the ability to restrict that Pagelines menu from other privileges, but really I want to restrict one of the two Admins, and am yet to find a plugin with this functionality :)

Share this post


Link to post
Share on other sites

Posted · Report post

Hi there,

 

You mean hide the pagelines tab from the wp admin area?

 

If you set the user to anything below admin it will automatically hide the pagelines tab from them. There's additional options inside Pagelines>site options>advanced to hide more options from the user depending on their user role.

 

Leave yourself as an admin and give the client the next role down.

Share this post


Link to post
Share on other sites