Skip to:
Content
Pages
Categories
Search
Top
Bottom

Custom profile tab for different user types


  • pooriaarab
    Participant

    @pooriaarab

    Hi,

    Using

    function profile_tab_event() {
        global $bp;
    
        bp_core_new_nav_item( array( 
              'name' => 'Events', 
              'slug' => 'event', 
              'screen_function' => 'event_screen', 
              'show_for_displayed_user' => false,
              'position' => 70,
              'parent_url'      => bp_loggedin_user_domain() . '/event/',
              'parent_slug'     => $bp->profile->slug,
              'default_subnav_slug' => 'event'
        ) );
    }
    add_action( 'bp_setup_nav', 'profile_tab_event' );
    
    function event_screen() {
      
      // Add title and content here - last is to call the members plugin.php template.
      add_action( 'bp_template_title', 'event_title' );
      add_action( 'bp_template_content', 'event_content' );
      bp_core_load_template( 'buddypress/members/single/plugins' );
    }
    function event_title() {
      echo 'Events';
    }
    
    function event_content() { 
      echo 'Content';
    }

    I created a new tab for users. But how can this be limited to specific user types? Different user types see different tab and/or different content in the tab?

    I suppose it could use this code:

     $member_type = bp_get_member_type( bp_displayed_user_id() );
                    if ( $member_type == 'userA' ) {
    

    Though not sure how to apply it.

    Any suggestions would help.

    using buddyboss theme

  • You must be logged in to reply to this topic.
Skip to toolbar