BuddyDev

Search

[Resolved] BP Profile Tab Pro – Default Tab Error

  • Participant
    Level: Enlightened
    Posts: 90
    Sujee Kulendran on #14525

    Hi Brajesh,

    I hope you are doing well.

    I’m having some trouble with the Profile Tab Pro plugin. I’ve made a new tab for a specific user role and designated that tab as the default landing page for that user role. I’m finding that the ‘default tab’ gets applied to all users and roles.

    For example, I added a tab called ‘Rollins College’ and defined it being added only to the user role ‘rollins23’ and then visible to ‘anyone’. Then I checked ‘set it as default component’ and then saved. What I am seeing is that although the user role ‘rollins23’ profile works, all other buddypress profiles shows a ‘403 error’ which occurs since they don’t have that tab activated. I would like to keep all other landing pages unchanged (i.e., their profile tab).

    Please help!

    Sujee

  • Keymaster
    (BuddyDev Team)
    Posts: 24645
    Brajesh Singh on #14542

    Hi Sujee,
    You are correct about the default tab. It applies to all or none.

    if you can tell me about your member types and provide the slugs for applying to these types, I can help with code.

    You will have to remove the default selection for the tab from the profile tabs plugin in that case.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 90
    Sujee Kulendran on #14543

    Hi Brajesh,

    Thank you for getting back so quickly.

    My member types are as follows:

    1. Admissions Counselor Member Type with slug = ‘admissions-counselor’

    2. Student Member Type with slug = ‘student’

    3. Guidance Counselors Member Type with slug = ‘guidancecounselors’

    4. Coaches Member Type with slug = ‘coaches’

    5. Other Member Type with slug = ‘other’

    Thanks!

    Sujee

  • Participant
    Level: Enlightened
    Posts: 90
    Sujee Kulendran on #14548

    Just to expand a bit – The admissions counselor member types are where the new Profile Tabs will be added and default direct to the new tab. For all the other member types, I wanted to keep the original default landing at Profile.

    Hope that makes sense.

    Sujee

  • Keymaster
    (BuddyDev Team)
    Posts: 24645
    Brajesh Singh on #14577

    Hi Sujee,
    Thank you. I will post the code today.

  • Participant
    Level: Enlightened
    Posts: 90
    Sujee Kulendran on #14590

    Thank you Brajesh!

  • Participant
    Level: Enlightened
    Posts: 90
    Sujee Kulendran on #14597

    Hi Brajesh – just a kind reminder. I look forward to testing out the code your provide.

    Sujee

  • Keymaster
    (BuddyDev Team)
    Posts: 24645
    Brajesh Singh on #14598

    Hi Sujee,
    You can use the following code

    
    /**
     * Conditionally update the landing tab.
     */
    function buddydev_set_member_type_based_default_component() {
    
    	if ( bp_is_user() && bp_has_member_type( bp_displayed_user_id(), 'admissions-counselor' ) ) {
    		define( 'BP_DEFAULT_COMPONENT', 'groups' ); //change groups with the slug of the tab you want to be default.
    	}
    }
    
    add_action( 'bp_init', 'buddydev_set_member_type_based_default_component',3 );
    
    

    Please make sure to change ‘groups’ with the slug of the tab you want to be default for the member type.

    Hope this heleps.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 90
    Sujee Kulendran on #14606

    Hi Brajesh,

    The code worked but a small problem with slug names. All members under member type ‘admissions-counselor’ will have the same slug ‘home’ but of course their permalink will be different since their member user names are different. However, I am unable to keep the slug ‘home’ same for all ‘admission-counselor’ default home pages and use the code you provided. Is there a trick to get around this?

    Sujee

  • Keymaster
    (BuddyDev Team)
    Posts: 24645
    Brajesh Singh on #14607

    Hi Sujee,
    I am sorry but I could not understand you last reply.

    We are not dealing with permalink here. It is for the default tab, so should work just fine if you click on a user’s link.

    Regards
    Brajesh

The topic ‘ [Resolved] BP Profile Tab Pro – Default Tab Error’ is closed to new replies.

This topic is: resolved