Skip to:

Hide profile tabs on user roles

  • Jake Reimer


    I would like to know if there is a way that I can hide profile tabs for certain users. I have 2 different user roles that are on my site “Vendor” and “Supporter”.

    Here’s what I want to do|
    – Hide the ‘Activity’ tab from the user role “Supporter”
    – Hide the ‘Profile’ tab from “Supporter”

    If anyone could please help me out that would be awesome! Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)

  • shanebp


    Untested, but try:

    function jake_nav_remove($nav_array) { 
        if( ! bp_is_my_profile() ) {
             $roles = wp_get_current_user()->roles;
             if (in_array('Supporter', $roles)) 
                 $nav_array = '';
        return $nav_array;
    add_filter('bp_get_displayed_user_nav_activity', 'jake_nav_remove', 10, 1 );
    add_filter('bp_get_displayed_user_nav_profile', 'jake_nav_remove', 10, 1 );

    However – removing these tabs can create problems – ‘profile’ is the default tab ( and therefore screen ) for member pages. You’ll need to decide on which tab should be default, since you may remove profile and activity.

    Jake Reimer


    Thank you! Should I add this to my functions.php?



    This sounds like what I am trying to do.

    I have a role “Partners” and the following function

    function remove_nav_items() {
        bp_core_remove_nav_item( 'notifications' );
        bp_core_remove_nav_item( 'groups' );
        bp_core_remove_nav_item( 'forums' );
        bp_core_remove_nav_item( 'activity' );
    add_action( 'bp_setup_nav', 'remove_nav_items');

    How can I make an “if” statement with this function?
    example: if role= ‘partners’ do remove_nav_items()

    I am having trouble figuring out how to get the user role of a logged in user.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Hide profile tabs on user roles’ is closed to new replies.
Skip to toolbar