WordPress

How To Add An Extra Tab To Buddyboss Profile

In this article, we will be going to learn how to add an extra tab to the Buddyboss profile.

Step-1: Use ‘bp_setup_nav’ action to add tab in buddy boss profile.

add_action( 'bp_setup_nav', 'subemployer_tabs' );

/* Employer Register when wpform submit end */
/* Show sub employer tab on employer profile */function subemployer_tabs() {
  global $bp;
  if( is_user_logged_in() ) {
    $current_id = bp_displayed_user_id();
    $get_user_data = get_userdata($current_id);
    $get_roles = $get_user_data->roles;
    $user = wp_get_current_user();
    $roles = ( array ) $user->roles;
    $currnt_user_id = get_current_user_id();
    // if($get_roles[0] == 'employer'){
      bp_core_new_nav_item( array(
        'name'                  => 'Sub Employers',
        'slug'                  => 'subemployer',
        'parent_url'            => $bp->displayed_user->domain,
        'parent_slug'           => $bp->profile->slug,
        'screen_function'       => 'subemployer_screen',   
        'position'              => 200,
        'default_subnav_slug'   => 'subemployer'
      ) );
    // }
  }
} 

function subemployer_screen() {
  add_action( 'bp_template_title', 'subemployer_screen_title' );
  add_action( 'bp_template_content', 'subemployer_screen_content' );
  bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
}

function subemployer_screen_title() { 
  echo 'Sub Employers';
}

function subemployer_screen_content() { 
  if( is_user_logged_in() ) {
    // add content here
    echo 'Sub Employers Content';
  }
} 
/* Show sub employer tab on employer profile end */

Here is the result.

Tarun Thummar

I'm a JR. WordPress Developer at Vision Infotech.Skilled in HTML,CSS,PHP, WordPress, and jQuery.

Share
Published by
Tarun Thummar
Tags: wordpress

Recent Posts

Testing hk

Testing

2 years ago

Create and Used PIPE in angular

In this article, we have to show Create and Used PIPE in angular

2 years ago

Operation

Testing

2 years ago

Create and Used PIPE in angular

In this article, we have to show Create and Used PIPE in angular

2 years ago

Create and Used PIPE in angular

In this article, we have to show Create and Used PIPE in angular

2 years ago

TETS NEW

test

2 years ago