• Resolved marikamitsos

    (@marikamitsos)


    We use both your excellent plugin as well as the modification for allowing menus and widgets.

    In the provided code you use the public function hide_admin_bar and as result you hide the whole of the front end Toolbar. Also, although it removes the Toolbar but leaves a void stripe on top.

    public function hide_admin_bar() {
            global $current_user;
            if ($this->user_has_allowed_role($current_user)) {
                // block front end admin menu bar
                show_admin_bar(false);
            }
        }

    We need to keep the admin bar but only have the Customizer removed.
    We tried to implement the following code from the codex into your code without success.

    function wpdocs_remove_customize( $wp_admin_bar ) {
        // Remove customize, background and header from the menu bar.   
        $wp_admin_bar->remove_node( 'customize' );  
        $wp_admin_bar->remove_node( 'customize-background' );   
        $wp_admin_bar->remove_node( 'customize-header' );   
    }
    add_action( 'admin_bar_menu', 'wpdocs_remove_customize', 999 );

    Can you please help on how to include it?

    PS: In general I believe that to remove all of the Toolbar is too much. When we do, it confuses users that have (under their profile) “Show Toolbar when viewing site” checked.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Vladimir Garagulya

    (@shinephp)

    Thread Starter marikamitsos

    (@marikamitsos)

    It works very well. Flawlessly!

    Great support as always.
    Thank you Vladimir

    PS: You could even safely update your code at your page.

    Thread Starter marikamitsos

    (@marikamitsos)

    Just one more thought about this Appearance modification.

    We use the code together with other custom modifications in a functionality must-use plugin that we also have in other sites.
    At the present time, we do have User Role Editor activated on this site.

    Will it cause any problems if we were to deactivate or just not have installed the User Role Editor (in some other site)?
    I mean I do not see an if function/hook that would not actually execute the code in other cases. Could you please see if you could include it, so it first checks whether User Role Editor is actually activated or network activated (for multisites)?

    I believe we should be using the functions is_plugin_active and is_plugin_active_for_network

    • This reply was modified 8 years, 2 months ago by marikamitsos.
    Plugin Author Vladimir Garagulya

    (@shinephp)

    This code does not depend from the User Role Editor. When you create an object from a class:

    
    new AppearancePermissions();
    

    constructor method __construct() is executed automatically.

    Thread Starter marikamitsos

    (@marikamitsos)

    You are right again.
    The reason we were concerned is because we use it with a custom role (teachers) created by User Role Editor.
    So if someone were to change the name (to professors) or delete the role and forgot to also change it in the plugin or comment out the class, we thought we would be in trouble.

    We tested it and noticed no issues whatsoever.

    Thanks again

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Could class AppearancePermissions hide just the customizer from admin bar?’ is closed to new replies.