BuddyDev

Search

Modify visibility of Existing Profile Tab (in buddypress profile )

  • Participant
    Level: Initiated
    Posts: 11
    slim kacem on #12515

    how can I Modify the visibility of existing profile Tab?
    is it possible with BuddyPress User Profile Tabs Creator Pro?
    thanks

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

    Hi Slim,
    At the moment you can not modify the visibility or slug of an existing menu.
    Changing the visibility is feasible though.

    We will add it in 1.0.4(or 5), which will be available around the 3rd week of January.

    For now, Here are the things you can do with the pre existing tab.
    https://buddydev.com/docs/guides/plugins/buddypress-plugins/buddypress-user-profile-tabs-creator-pro/modify-existing-profile-tab/

    Thank you
    Brajesh

  • Participant
    Level: Initiated
    Posts: 11
    slim kacem on #12521

    Thanks for your reply Brajesh

    I found your code in buddypress forum

    add_action(‘bp_friends_setup_nav’,’bpdev_custom_hide_friends_if_not_self’);
    
    function bpdev_custom_hide_friends_if_not_self(){
    if(bp_is_my_profile()|| is_super_admin())
    return ;
    
    bp_core_remove_nav_item(‘friends’);
    
    }

    .

    it is to limit visibility to only profile owner and admin, did you think it’s still working?
    can you help me with modified code to: -limit the visibility of tab to only loged in members.
    -limit the visibility of tab to only freinds and admin.

    thanks

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

    Hi Slim,
    Here is the code that you can use to limit the visibility to User(self), friends and siteadmin

    
    
    /**
     * Remove the friends menu from user profile if visiting someone else's profile and is not friend.
     */
    function bpdev_custom_hide_friends_if_not_self() {
    	if ( bp_is_my_profile() || is_super_admin() || friends_check_friendship( bp_displayed_user_id(), bp_loggedin_user_id() ) ) {
    		return;
    	}
    
    	bp_core_remove_nav_item( 'friends' );
    
    }
    add_action('bp_friends_setup_nav','bpdev_custom_hide_friends_if_not_self');
    
    

    The old code is still working. But the code you have posted is using encoded quotes which will cause fatal error. Need to replace

    with

    
    '
    

    or

    
    "
    

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 11
    slim kacem on #12526

    Thank you for your help.

    I tried your code and it’s working for me except for groups and forums.

    I am trying to hide them for non logged users.

    Her is my code

    function bpdev_custom_hide() {
        // show only for those people
        if ( bp_is_my_profile() || is_super_admin() ) {
            return;
        }
        if (! is_user_logged_in()) {
            bp_core_remove_nav_item( 'activity' );
            bp_core_remove_nav_item( 'friends' );
            bp_core_remove_nav_item( 'groups' ); // not working
            bp_core_remove_nav_item( 'forums' ); // not working
            bp_core_remove_nav_item( 'articles' ); // not working
        }
        else if (! bp_is_my_profile()) {
            bp_core_remove_subnav_item( 'activity', 'mentions' );
            bp_core_remove_subnav_item( 'activity', 'favorites' );
            bp_core_remove_subnav_item( 'activity', 'friends' );
            bp_core_remove_subnav_item( 'activity', 'groups' );
    
            bp_core_remove_nav_item( 'friends' );
            return;
        }
    
        //else if (! friends_check_friendship( bp_displayed_user_id(), bp_loggedin_user_id())) {    
        //}
    }
    add_action('bp_friends_setup_nav','bpdev_custom_hide');

    Thank you.

  • Participant
    Level: Initiated
    Posts: 11
    slim kacem on #12738

    Hi Brajesh, BuddyPress User Profile Tabs Creator Pro plugin 1.0.2 is published, did it support friends visibility now?
    Can you have a look to my programm in the previous comment please.

    Thanks

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

    Hi Slim,
    Please upgrade to 1.0.3
    https://buddydev.com/plugins/buddypress-user-profile-tabs-creator-pro/

    I have added support for Friends, Followers, Following visibility level depending on whether Friends component is enabled and the BP Follow plugin is active.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 11
    slim kacem on #13449

    Hi Brajesh

    I’m waiting for the upgrade that allow the modification of the visibility of existing profile Tab. Is it coming soon?

    Thanks

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

    Hi Slim,
    Sorry for the delays. We lost till 10th feb due to some issues. Please allow me to post it on 19th. Yes, It is coming and the Remove existing nav item is coming too.

    Thank you
    Brajesh

  • Participant
    Level: Initiated
    Posts: 11
    slim kacem on #13452

    Grate thanks

    I have another question is it possible to modify a tab to a sub tab with the plugin.
    In fact, follower plugin adds 2 tabs to the buddypress profil, is it possible to moved this 2 tabs in one tab containing 2 sub tabs.

    Thanks

You must be logged in to reply to this topic.

This topic is: not resolved