BuddyDev

Search

[Resolved] Remove activity tab for specific member type on members page/members loop

Tagged: ,

  • Participant
    Level: Initiated
    Posts: 4
    beohs on #11511

    Hi,
    is it possible to remove activity tab (or others) for member types on members page?

    I’ve seen it is working for add friend button in this post https://buddydev.com/support/forums/topic/remove-add-friend-button-for-member-type-on-members-pagemembers-loop/#post-8565

    Thanks for help.

  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #11529

    Hi,
    I am sorry, I missed your post on forum.

    1. Do you mean the profile activity tab? Yes, it is but it qill most probably break the site if you don’t set some other component as the default component.

    Please let me know your goals and I will be able to assist.

    Thank you
    Brajesh

  • Participant
    Level: Initiated
    Posts: 4
    beohs on #11530

    Yes. I already set profile as default and want to hide activity and media tab for special member types….

  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #11540

    Hi Behos,
    Please use the following example.

    
    
    /**
     * Hide User activity tab for displayed user.
     *
     * Unless you have default component set to something else, this is not recommended.
     */
    function buddydev_hide_displayed_user_activity_tabs() {
    
    	if ( ! bp_is_user() ) {
    		return ;
    	}
    
    	// want to do it based on role? use capability and do it.
    	if ( ! user_can( bp_displayed_user_id(), 'manage_options' ) ) {
    		bp_core_remove_nav_item( 'activity' );
    	}
    
    	// want to do it based on member types? un comment the following block and modify
    	/*
    	if ( bp_has_member_type( bp_displayed_user_id(), 'some_member_type' ) ) {
    		bp_core_remove_nav_item( 'activity' );
    	}*/
    }
    add_action( 'bp_setup_nav', 'buddydev_hide_displayed_user_activity_tabs', 11 );
    
    

    Please feel free to adapt to your use case.

    hope that helps.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 4
    beohs on #11543

    Works like a charm. Thank you very much 😉

    • This reply was modified 7 years, 1 month ago by beohs.
  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #11547

    You are most welcome 🙂

The topic ‘ [Resolved] Remove activity tab for specific member type on members page/members loop’ is closed to new replies.

This topic is: resolved