BuddyDev

Search

[Resolved] Hide Upper Right Menu at top bar

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2935
    Ravi on #4070

    Hi Dandy,

    Thank you for the acknowledgement that You are using User Role Editor to create user role teacher or principal. I thought teacher and principal are BuddyPress Member type. I will post here the new code.

    Thank You
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2935
    Ravi on #4081

    Hi Dandy,

    Please try the following code. I have created role using WP Role Editor and test.

    
    function buddydev_remove_unwanted_menu() {
    
        global $wp_admin_bar;
    
        $user   = wp_get_current_user();
        $remove = false;
    
        // teacher, principal your role id
        if ( in_array( 'teacher', (array) $user->roles ) ) {
            $remove = true;
        } elseif ( in_array( 'principal', (array) $user->roles ) ) {
            $remove = true;
        }
    
        if ( $remove ) {
    
            $node_ids = array(
                'my-account-xprofile-edit',
                'my-account-xprofile-change-avatar',
                'my-account-xprofile-change-cover-image'
            );
    
            foreach( $node_ids as $id ) {
                $wp_admin_bar->remove_node( $id );
            }
    
        }
    
    }
    add_action( 'wp_before_admin_bar_render', 'buddydev_remove_unwanted_menu' );
    
    

    Let me know if It is working for you or not.

    Thank You
    Ravi

  • Participant
    Level: Enlightened
    Posts: 146
    Dandy Jefferson on #4090

    Hi, Ravi
    Thank you very much for the continued update. It works perfectly as I expected.

    Thanks. I will mark it as resolved.

    By the way, I submitted a plugin suggestion about couple of days ago about notification function. If you get time, could you view that suggestion and see whether it’s worth to create it?

    Thank you very much.

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2935
    Ravi on #4098

    Hi Dandy,

    Thank You for the acknowledgement. Sure, We will look forward on your plugin suggestion and will let you know.

    Thank You
    Ravi

You must be logged in to reply to this topic.

This topic is: resolved