BuddyDev

Search

Issue with provided code (profile tab depending to member type)

  • Participant
    Level: Enlightened
    Posts: 38
    Beuza on #11909

    Hi Brajesh,

    Sorry if it’s not allowed to open new topic in this kind of case.
    I finally have an issue with the code: member type Player can’t integrate agent’s group. I don’t want group menu tab display in their profile but i would like Players can integrate groups. The goal is to create a kind of agent portfolio for showing to scouts for example.
    Could you help me please?
    Thanks,

    Beuza

    Provided code:

    /**
     * Remove groups from user profile based on member type.
     */
    function buddydev_remove_group_based_on_member_types() {
    	if ( ! bp_is_user() ) {
    		return;
    	}
    
    	$user_id = bp_displayed_user_id();
    
    	if ( ! bp_has_member_type( $user_id, 'agent' ) ) {
    		bp_core_remove_nav_item( 'groups' );
    	}
    
    }
    
    add_action( 'bp_setup_nav', 'buddydev_remove_group_based_on_member_types', 1001 );
    
    /**
     * Remove groups from adminbar based on member type.
     *
     * @param array $nav nav items.
     *
     * @return array
     */
    function buddydev_filter_show_hide_groups_in_adminbar( $nav ) {
    	if ( ! is_user_logged_in() ) {
    		return $nav;
    	}
    
    	if ( ! bp_has_member_type( bp_loggedin_user_id(), 'agent' ) ) {
    		$nav = array();
    	}
    
    	return $nav;
    }
    
    add_filter( 'bp_groups_admin_nav', 'buddydev_filter_show_hide_groups_in_adminbar' );
    
  • Participant
    Level: Enlightened
    Posts: 38
    Beuza on #11910

    *a kind of players portfolio for the agent

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #11911

    Hi Beuza,
    Thank you for posting.

    Can you please explain this in more details?

    
    member type Player can’t integrate agent’s group
    

    What do you mean by this integration. In the above code, We are only removing tabs from profile but not stopping any user from joining it or anything.

    Thank you
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 38
    Beuza on #11917

    Thank you for your reply,

    I mean, when an agent send an invitation for a player to integrate his group, player can’t accept because of error page: “Oops! That page can’t be found” when he clicks on notification message of invitation. DO you know why?

    Thanks,

    Beuza

  • Participant
    Level: Enlightened
    Posts: 38
    Beuza on #11920

    The page of group invitation acceptance is a submenu of the group tab we desactive for player and scout. I think the question is how to put the sub menu Invitation in another profil tab like Friends tab for exemple.

    Beuza

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #11960

    Hi Beuza,
    Are you using a 3rd party plugin or is it normal group invitations? I will try to help but not sure if I will be of much help.

  • Participant
    Level: Enlightened
    Posts: 38
    Beuza on #11961

    Brajesh,

    No 3rd party plugin, it’s a normal group invitation. The display of invitation reception is located in the Group Tab as sub menu “Invitation”. So when a Player receive group invitation, he can’t to see it because the page doesn’t exist for its member type (Thanks to the appreciate code you did provide me). It’s for that reason i think the solution is to move sub menu “Invitation” in another tab. I just don’t know how to do that. Could you help me please?

    Thanks,

    Beuza

  • Participant
    Level: Enlightened
    Posts: 38
    Beuza on #11992

    Hello brajesh,

    Sorry to insist like that, i am really grateful for the help you give me.
    Could you take a look at my case please?

    Thanks,

    Beuza

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #11993

    Hi Beuza,
    It needs some time as I still need to check if simply moving tabs will work or we will have to filter at other places.

    Since it needs significant time(anywhere between 30 mins to 1 hour), I will need atleast a few days. As soon as I am done with my current priority(MediaPress release), I will work on it and help you. I am hoping to hope you with it by Sunday.

    Thank you
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 38
    Beuza on #11997

    Brajesh,

    Understood!

    Thank you so much,

    Beuza

You must be logged in to reply to this topic.

This topic is: not resolved