Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'bp_core_remove_nav_item'

Viewing 25 results - 76 through 100 (of 114 total)
  • Author
    Search Results
  • #171306
    bp-help
    Participant

    @catwomanbadkitty

    
    function bphelp_remove_activity_from_profile(){
    bp_core_remove_nav_item('activity');
    }
    add_action('bp_activity_setup_nav','bphelp_remove_activity_from_profile');
    
    Ishanna
    Participant

    Hallo @sbrajesh !

    I tried use code:

    
    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’);
    
    }
    
    

    I copied and pasted the code into the ‘bp_custom.php’ file but it did not work for me.
    I’m new to wordpress, html, php and css but I seem to find my way til now. Some advise please? I really need this option to work and I can’t find a plugin that cover this.

    Kind regards,

    #166485
    Brajesh Singh
    Participant

    If you guys mean the the sites from the navigation, then you can use the following code in either your theme’s functions.php or bp-custom.php

    
    function bpdev_remove_blogs_nav(){
        global $bp;
    
        bp_core_remove_nav_item($bp->blogs->id);//
    
    }
    add_action('wp_loaded','bpdev_remove_blogs_nav');
    

    Hope that helps.

    #164055
    Grant Derepas
    Participant

    Achieved what I was after with the following code

    function global_remove_media_tab() {
    
    global $bp;
    
    $profileid = bp_displayed_user_id();
    $profiletype = xprofile_get_field_data( 'User Type', $profileid );
    if ($profiletype == 'Groupie'){
    	bp_core_remove_nav_item('media');
    	}
    }
    
    add_action('bp_setup_nav','global_remove_media_tab');
    #164051
    Grant Derepas
    Participant
    //For own profile
    //First i need the logged in users id
    function global_remove_media_tab() {
    
    global $bp;
    
    $userid = bp_loggedin_user_id();
    //Then use that ID to work out what type of user they are
    $usertype = xprofile_get_field_data( 'User Type', $userid );
    if ($usertype == 'Groupie'){
    	bp_core_remove_nav_item('media');
    	}
    }
    
    add_action('bp_setup_nav','global_remove_media_tab');

    Ok this code “works”.
    But it removes the media tab for every profile when logged in as a “Groupie” User type.
    What I want is to remove the tab from all Groupie Member profiles only including groupie members looking at their own profile.

    #164048
    Grant Derepas
    Participant
    
    //For own profile
    //First i need the logged in users id
    global $bp;
    $userid = bp_loggedin_user_id();
    //Then use that ID to work out what type of user they are
    $usertype = bp_profile_field_data( 'field=User Type&user_id=$userid' );
    
    if ($usertype == 'type1'){
    	function remove_media_tab(){
    	bp_core_remove_nav_item('media');
    	}
    }
    
    add_action('bp_friends_setup_nav','remove_media_tab');
    

    Ok updated that code and added it to my themes functions.php file.

    Upon testing the code doesn’t seem to be doing anything. Logged in as specified user type and viewed my own profile as well as another member of that types profile and both are still showing the media tab.

    Thoughts?

    #156742
    daganread
    Participant

    I know this thread is 2 years old. But here’s my problem:

    I would like to display different member profiles for different types of groups. I have 2 groups: faculty and contributor. More accurately i want to disable components like bp Links and group docs wiki for the faculty group; i settled for removing the links to such.

    i thought the best approach would be to check if a member is of a certain group and then based on the conditional statement, remove the unnecessary tabs in the profile menu. If there is a better approach. Please lead the way:)

    in my theme’s function.php:

    `
    if(groups_is_user_member( bp_loggedin_user_id(), BP_Groups_Group::get_id_from_slug(‘faculty’))){

    function setup_nav() {
    global $bp;

    // Remove a menu item
    bp_core_remove_nav_item( ‘messages’ );

    }

    add_action( ‘bp_setup_nav’, ‘setup_nav’, 1000 );
    }
    `

    if i make the conditional statement truthy the appropriate tab is removed. If i stick the code in the if statement into something like header.php it works. BUT for some reason, together they do not.

    Perhaps functions.php cannot reach such functions? I tried putting it into bp-custom.php, site just crashed.

    Thank you for your time, any help would be appreciated 🙂

    Brajesh Singh
    Participant

    You Can put this code in your bp-custom.php and It will take care of your issue

    `
    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’);

    }

    `

    hope that helps.

    #143662
    modemlooper
    Moderator

    bp_core_remove_nav_item()

    #140276
    modemlooper
    Moderator

    `function my_func_remove_xprofile_tabs(){
    global $bp;
    bp_core_remove_nav_item( ‘events’ );
    }
    add_action( ‘bp_setup_nav’, ‘my_func_remove_xprofile_tabs’, 15 );`

    #140270
    Roger Coathup
    Participant

    @shemada – to do this properly, you need to use the bp_core_remove_nav_item() function.

    Add a call to it in your theme’s functions.php file passing in the ID of the Events nav item.

    If you Google on here for ‘remove_nav_item’ you should find plenty of previous threads / examples.

    #139440
    mystica
    Member

    this made the trick

    function mj_remove_groups_nav() {
    bp_core_remove_nav_item( ‘activity’ );

    }
    add_action( ‘bp_setup_nav’, ‘mj_remove_groups_nav’, 15 );

    David
    Member

    AND I solved my own problem by typing it out here.

    YES – bp_core_remove_nav_item( ‘invite-anyone’ );

    My other solution was not working because it is not a subnav. As soon as I typed that I realized it.

    Thanks again for help.

    #123678

    In reply to: Moving Links around

    leethompson
    Member

    ok, I found out if you remove a parent item the page(function) is removed too, So I removed this function:
    `function boone_remove_blogs_nav() {
    bp_core_remove_nav_item( ‘privacy’ );
    bp_core_remove_nav_item( ‘settings’ );
    bp_core_remove_nav_item( ‘invite-anyone’ );
    }
    add_action( ‘bp_setup_nav’, ‘boone_remove_blogs_nav’, 15 );`

    and I used css to hide the parent item. In my themes main css I added :

    `#user-privacy {
    display: none !important;
    }

    #user-settings {
    display: none !important;

    }
    `

    Now I will write a javascript function to highlight the right parent item if I am in the proper section.

    Then i will try to write a bp global function to re-assign subnav items to different parent item.

    leethompson
    Member

    This is a great post but what about moving sub links to a new parent item, this kinda works but if I remove the parent item the function stops. in my themes functions.php

    `function remove_blogs_nav() {
    bp_core_remove_nav_item( ‘privacy’ );
    bp_core_remove_nav_item( ‘settings’ );
    bp_core_remove_nav_item( ‘invite-anyone’ );
    }
    add_action( ‘bp_setup_nav’, ‘remove_blogs_nav’, 15 );

    function bp_add_create_group_subnav() {
    global $bp;
    $groups_link = ‘/groups-2/’;
    $settings_link = $bp->loggedin_user->domain ;

    /* Add the subnav items to the groups nav item */
    if (function_exists(‘bp_core_new_subnav_item’)) {
    bp_core_new_subnav_item( array(
    ‘name’ => __( ‘Create Clan’, ‘buddypress’ ),
    ‘slug’ => ‘create’,
    ‘parent_url’ => $groups_link,
    ‘parent_slug’ => $bp->groups->slug,
    ‘screen_function’ => ‘groups_screen_group_home’,
    ‘position’ => 40,
    ‘item_css_id’ => ‘home’ ) );

    bp_core_new_subnav_item( array(
    ‘name’ => __( ‘Settings’, ‘buddypress’ ),
    ‘slug’ => ‘settings’,
    ‘parent_url’ => $settings_link,
    ‘parent_slug’ => $bp->profile->slug,
    ‘screen_function’ => ‘profile-settings’,
    ‘position’ => 30,
    ‘item_css_id’ => ‘profile-settings’ ) );

    bp_core_new_subnav_item( array(
    ‘name’ => __( ‘Privacy’, ‘buddypress’ ),
    ‘slug’ => ‘privacy’,
    ‘parent_url’ => $settings_link,
    ‘parent_slug’ => $bp->profile->slug,
    ‘screen_function’ => ‘profile-privacy’,
    ‘position’ => 30,
    ‘item_css_id’ => ‘profile-privacy’ ) );

    }
    }
    add_action(‘bp_setup_nav’, ‘bp_add_create_group_subnav’);
    `
    If I comment out :
    `// bp_core_remove_nav_item( ‘privacy’ );
    // bp_core_remove_nav_item( ‘settings’ );`

    The sub links are in the Profile item, and functional, but still link to each original man item.

    thanks Boone you are a lot of help

    #121845
    Sven Lehnert
    Participant

    add it in your function.php

    function remove_group_home_nav() {
    bp_core_remove_nav_item( bp_get_current_group_slug(), ‘home’ );
    }
    add_action( ‘bp_setup_nav’, ‘remove_group_home_nav’ );

    jonnyauk
    Participant

    Ah, my mistake – this code does actually work HOWEVER , I can’t get it to hide ‘Send Invites’ or anything else under the group menu… do I have to do something different?

    `function ja_remove_navigation_tabs() {
    bp_core_remove_nav_item(‘friends’);
    bp_core_remove_nav_item(‘settings’);
    }
    add_action( ‘bp_setup_nav’, ‘ja_remove_navigation_tabs’, 15 );`

    r-a-y
    Keymaster

    @nahummadrid – This is a known bug. Using bp_core_remove_nav_item() will remove access to those pages as well. Right now, I’d suggest hiding the nav item via CSS or by hacking the $bp global to remove the item.

    Nahum
    Participant

    `function boone_remove_groups_nav() {
    bp_core_remove_nav_item( ‘groups’ );
    }
    add_action( ‘bp_setup_nav’, ‘boone_remove_groups_nav’, 15 );
    `
    When I put in functions it doesn’t work at all. The only way i get this to work is putting it in the BP-Custom but then it cuts off all access to groups and forum subpages….can’t figure why

    Nahum
    Participant

    I thought the same would work for groups…but it’s throwing the group count # up above the header when I use alone or in conjunction with the blogs snippet.

    `function remove_groups_nav_for_zero() {
    global $bp;
    if ( bp_groups_total_count_for_user() == 0 )
    bp_core_remove_nav_item( $bp->groups->slug );
    }
    add_action( ‘bp_setup_nav’, ‘remove_groups_nav_for_zero’, 11 );
    `

    Any ideas why this is happening…and not with the blogs one.

    #107146
    pcwriter
    Participant

    @christophG

    You can do this with the s2member plugin. In the “API/Scripting” section, you’ll find some advanced conditionals that can be added in your theme templates, or included in a custom function. If you’re using s2member, you could try adding this to your theme’s functions.php file… should work anyway ;-)

    `function remove_member_profile_nav() {
    if (!current_user_can(‘access_s2member_level1’)) {
    bp_core_remove_nav_item( ‘profile’ );
    }
    }
    add_action( ‘bp_setup_nav’, ‘remove_member_profile_nav’, 15 );`

    #103461

    In reply to: Hide General Settings

    r-a-y
    Keymaster

    Add the following to your theme’s functions.php:

    `function ray_bp_remove_settings() {
    global $bp;

    // removing the existing settings tab
    bp_core_remove_nav_item( $bp->settings->slug );
    }
    add_action( ‘init’, ‘ray_bp_remove_settings’, 0 );

    function ray_bp_readd_settings() {
    global $bp;

    // add a new settings tab to use notifications as default tab
    bp_core_new_nav_item( array( ‘name’ => __(‘Settings’, ‘buddypress’), ‘slug’ => $bp->settings->slug, ‘position’ => 100, ‘show_for_displayed_user’ => false, ‘screen_function’ => ‘bp_core_screen_notification_settings’, ‘default_subnav_slug’ => ‘notifications’ ) );

    // bug in bp_core_remove_subnav_item(), we have to hack the screen function so it displays the notifications screen when you land on /settings/
    if ( $bp->current_component == $bp->settings->slug && $bp->current_action == ‘general’ )
    add_action( ‘wp’, ‘bp_core_screen_notification_settings’, 3 );

    // add back the subnav notifications tab
    $settings_link = $bp->loggedin_user->domain . $bp->settings->slug . ‘/’;

    bp_core_new_subnav_item( array( ‘name’ => __( ‘Notifications’, ‘buddypress’ ), ‘slug’ => ‘notifications’, ‘parent_url’ => $settings_link, ‘parent_slug’ => $bp->settings->slug, ‘screen_function’ => ‘bp_core_screen_notification_settings’, ‘position’ => 20, ‘user_has_access’ => bp_is_my_profile() ) );
    }
    add_action( ‘init’, ‘ray_bp_readd_settings’ );`

    Tested lightly. Encountered a few bugs, but this will work…

    #98864
    Brajesh Singh
    Participant

    Hi,
    The private updates on group should not be visible to anyone other than the profile owner. It means something is wrong, you should check other plugins.
    btw, yes, you can remove the activity section from profile. put the following code in your theme’s functions.php

    `
    global $bp;
    bp_core_remove_nav_item($bp->activity->id);
    `
    But this will make the profile inaccessible, as activity is set as the default profile component. so you may want to put the following code in bp-custom.php
    `
    define(“BP_DEFAULT_COMPONENT”, “profile”);
    `
    hope that helps.

    #93042
    youngmicroserf
    Participant

    I’m bumping this because the @-mention above didn’t work, apparently.

    @boonebgorges,

    for some reason, your suggested solution doesn’t work. I suppose it has to do with the hook, but using bp_core_remove_nav_item(‘groups’) doesn’t work at ‘bp_setup_nav’, while it does work at the point @mariochampion suggested.

    Here’s a problem, though, in my installation, when I remove the nav link, I am no longer able to access group pages. I can access the group directory and groups will be displayed there, but clicking on a group will take me to the front page. Is this a bug? It seems like it, since the function is supposed to only remove the navigation item, not access to the feature, am I right? Or am I not getting something? Is there a better way to remove the navigation item?

    #92986
    youngmicroserf
    Participant

    Hmm. Is this the intended effect? I removed the “groups” element from the navigation bar on the profile using the bp_core_remove_nav_item-function, but after doing that I was no longer able to access any group and after directly entering the group’s URL I will be redirected to the homepage. Is there any way to remove items from the *navigation* but keep them available for direct access? Bizarrely, I am able to display the groups directory page when the bp_core_remove_nav_item(‘groups’)-function is active, but not individual group homepages. Clicking on a group name will take me to the homepage.

    Are there other options for menu item removal?

    Thanks!

Viewing 25 results - 76 through 100 (of 114 total)
Skip to toolbar