BuddyBoss Home – Web Support Forums Themes Boss. theme Different My Profile MENUS on Desktop and Mobile

Viewing 4 posts - 1 through 4 (of 4 total)
  • Question

    #45464
    @ryan-valdez

    I just recently changed My Profile Navigation Menu to display a different menu with less links and no Sub Nav links. I did this by creating a new menu and assigning it to the My Profile Menu.

    The Menu works for Desktop but when I view the site on Mobile, the My Profile Menu is the SAME menu before I created the new menu.

    My question is, how can I get the My Profile Menu to be the SAME for the Desktop and Mobile Screen? My desktop has the right new Menu for My Profile, but the Mobile screen has the OLD My Profile Menu displaying all of the links and sub links that I wanted to remove by creating the new menu.

    Answers

    #45469
    @vapvarun

    Hi @ryan-valdez, Mobile is using WP admin bar menus and we have included addition menu location ” Profile Menu ” .

    You will get additional menu for mobile when it will be included as BP_nav_bar

    https://codex.buddypress.org/getting-started/guides/deprecated-guides/modifying-the-buddypress-admin-bar/

    The only solution would be remove everything from the menu and re-add it manually.

    Regards
    Varun Dubey

    #45608
    @ryan-valdez

    Thank you for the follow up. Any chance I could get led in the right direction, maybe an example of what I would need to do to remove and or add menus?

    #45653
    @vapvarun

    Hi @ryan-valdez, take a look of following codes.
    You can add them inside child theme fucntions.php

    
    add_action('wp_before_admin_bar_render', 'update_wp_menus', 999);
    function update_wp_menus()
     {
      global $wp_admin_bar, $bp;
    
      $domain = $bp->loggedin_user->domain;
    
      $profile_link = $domain . $bp->activity->slug . '/';
    
      $activity_link = trailingslashit( $domain . $bp->activity->slug );
    
      // ADD ITEMS
      if ( is_user_logged_in() )
      {
       // REMOVE ITEMS
       $wp_admin_bar->remove_menu('my-account-friends');
       $wp_admin_bar->remove_menu('my-account-follow');
       $wp_admin_bar->remove_menu('my-account-groups');
       $wp_admin_bar->remove_menu('my-account-notifications');
       $wp_admin_bar->remove_menu('my-account-messages');
       $wp_admin_bar->remove_menu('my-account-xprofile');
       $wp_admin_bar->remove_menu('my-account-media');
       $wp_admin_bar->remove_menu('my-account-settings');
       $wp_admin_bar->remove_menu('mycred-account');
    
       
       $wp_admin_bar->add_menu( array(
        'parent' => $bp->my_account_menu_id,
        'id'     => 'my-account-friends',
        'title'  => __( 'Friends', 'buddypress' ),
        'href'   => trailingslashit( bp_loggedin_user_domain().'friends' )
       ) );
       
       $wp_admin_bar->add_menu( array(
        'parent' => $bp->my_account_menu_id,
        'id'     => 'my-account-follow',
        'title'  => __( 'Follow', 'buddypress' ),
        'href'   => trailingslashit( bp_loggedin_user_domain().'following' )
       ) );
       
       $wp_admin_bar->add_menu( array(
        'parent' => $bp->my_account_menu_id,
        'id'     => 'my-account-groups',
        'title'  => __( 'Groups', 'buddypress' ),
        'href'   => trailingslashit( bp_loggedin_user_domain().'groups' )
       ) );
       
       $count = bp_notifications_get_unread_notification_count( bp_loggedin_user_id() );
       $title  = sprintf( _x( 'Notifications <span class="count">%s</span>', 'My Account Notification pending', 'buddypress' ), number_format_i18n( $count ) );
       $wp_admin_bar->add_menu( array(
        'parent' => $bp->my_account_menu_id,
        'id'     => 'my-account-notifications',
        'title'  => __( $title , 'buddypress' ),
        'href'   => trailingslashit( bp_loggedin_user_domain().'notifications' )
       ) );
       
       $count = messages_get_unread_count();
       if ( !empty( $count ) ) {
    		$title = sprintf( __( 'Messages <span class="count">%s</span>', 'buddypress' ), number_format_i18n( $count ) );
    	} else {
    		$title = __( 'Messages', 'buddypress' );
    	}
       $wp_admin_bar->add_menu( array(
        'parent' => $bp->my_account_menu_id,
        'id'     => 'my-account-messages',
        'title'  => __( $title, 'buddypress' ),
        'href'   => trailingslashit( bp_loggedin_user_domain().'messages' )
       ) );
       
       $wp_admin_bar->add_menu( array(
        'parent' => $bp->my_account_menu_id,
        'id'     => 'my-account-xprofile',
        'title'  => __( 'Profile', 'buddypress' ),
        'href'   => trailingslashit( bp_loggedin_user_domain().'profile/timeline' )
       ) );
       
       $wp_admin_bar->add_menu( array(
        'parent' => 'my-account-xprofile',
        'id'     => 'my-account-xprofile-timeline',
        'title'  => __( 'Timeline', 'buddypress' ),
        'href'   => trailingslashit( bp_loggedin_user_domain().'profile/timeline' )
       ) );
        
      
       $wp_admin_bar->add_menu( array(
        'parent' => $bp->my_account_menu_id,
        'id'     => 'my-account-settings',
        'title'  => __( 'Settings', 'buddypress' ),
        'href'   => trailingslashit( bp_loggedin_user_domain().'settings' )
       ) );
      }
     }
    

    Regards
    Varun Dubey

Viewing 4 posts - 1 through 4 (of 4 total)
  • The question ‘Different My Profile MENUS on Desktop and Mobile’ is closed to new replies.