Skip to:
Content
Pages
Categories
Search
Top
Bottom

How I hide my un-wanted profile tabs

  • Avatar of sundev
    sundev
    Participant

    @sundev

    Hi, I intend to hide some of my profile tab with this css below but is not working, did I missed anything please?

    /* Hide Certain Profile Icons */
    #user-activity {
    display: none;
    }
    #user-xprofile {
    display: none;
    }
    #user-friends {
    display: none;
    }
    #user-groups {
    display: none;
    }
    #user-profile {
    display: none;
    }
    #user-settings {
    display: none;
    }
    #user-messages {
    display: none;
    }
    #user-forums {
    display: none;
    }

    but when I hide with php like so:

    // hide a menu item
    $bp->bp_nav['forums'] = false;
    $bp->bp_nav['group'] = false;

    it hides the tabs but left a small space at the left side; beginning of the tabs, before activity! please any idea on how I could fix this? Thanks

Viewing 9 replies - 1 through 9 (of 9 total)
  • Avatar of sundev
    sundev
    Participant

    @sundev

    Your help is appreciated

    Avatar of henrywright
    henrywright
    Moderator

    @henrywright

    Hi @sundev

    Have you tried using bp_core_remove_nav_item( 'slug' )? There is also a function available in BP to remove sub-nav items bp_core_remove_subnav_item( 'slug', 'subnav-slug' )

    Avatar of sundev
    sundev
    Participant

    @sundev

    Thanks @Henry for your reply. It works for my subnavs but did not for the navs, perhaps, I don’t know how to apply it. I used:

    //hide navs
    function my_setup_nav(){
    global $bp;
    $bp->bp_nav['forums']=false
    add_action(‘bp_setup_nav’, ‘my_setup_nav’, 1000);

    it works and is hidded but I used with

    // rename tabs
    function mb_profile_menu_tabs(){
    global $bp;
    $bp->bp_nav['messages']['name']=’Mails’;
    add_action(‘bp_setup_nav’,’mb_profile_menu_tabs’,201);

    to rename some tabs and it worked as well but the counting bubble in the fronts disappeared and a small space is left before the activity tab. Could it be my functions that is causing extra space? how can I still retain those bubbles after renamed, Any idea please? Sorry for bothering you so much.
    Thanks in anticipation.

    Avatar of shanebp
    shanebp
    Moderator

    @shanebp

    For renaming things, the recommended practice is to use a language file:

    http://codex.buddypress.org/getting-started/customizing/customizing-labels-messages-and-urls/

    If you make a lot of changes, you should use that approach.

    The ‘counting bubble’ is filled using sprintf.
    You’re missing that call from your change.
    You could try
    $bp->bp_nav['messages']['name']='Mails <span>%d</span>';
    But I’d be surprised if it works.

    Here’s another method, that you can paste in your functions.php:

    function sundev_change_buddypress_profile_tabs( $translated, $original_text, $domain ) {
    
        if ( 'buddypress' !== $domain )  {
            return $translated; 
        }
    
        switch ( $original_text ) {
        
            case 'Messages <span>%d</span>':
                return 'Mails <span>%d</span>';
    
            case 'Messages':
                return 'Mails';
                			
            default:
                return $translated;
        }
    }
    add_filter( 'gettext', 'sundev_change_buddypress_profile_tabs', 10, 3 );

    Untested, but that should change the label in both a profile and the buddy-bar.

    Avatar of henrywright
    henrywright
    Moderator

    @henrywright

    @shanebp just wondering, is there an advantage of filtering gettext over a introducing a language file and using Poedit? I was told recently using a language file isn’t a good idea. See here

    http://stackoverflow.com/questions/21932828/translating-wordpress-which-naming-convention-should-i-use-when-defining-the-la

    Avatar of shanebp
    shanebp
    Moderator

    @shanebp

    @henrywright – Obmerk makes an excellent argument.

    But whatever works for each person.

    I like filtering gettext because it’s faster than the poedit dance.

    Avatar of henrywright
    henrywright
    Moderator

    @henrywright

    @shanebp so does the language folder get overwritten on WP upgrade? If it does then get text is the way to go every time in my opinion. If it doesn’t then I can see no wrong in the use of a language file.

    Avatar of sundev
    sundev
    Participant

    @sundev

    @Shanebp and @Henry thanks for the greate replys and info am giving language file a seriouse consideration after this adventure :).

    @Shanebp thanks, the ‘<spand>%d</spand>’ brings back the bubbles but instead of figures this %d shown inside the bubble shape, any idea please?

    Avatar of sundev
    sundev
    Participant

    @sundev

    I really appreciate you guys for your replies, Though I could not hide and link to as I thought I could, but have successfully removed both nav & sub-nav and I am satisfied. Thanks a lot, God bless you.

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

You must be logged in to reply to this topic.