Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'bp_core_remove_nav_item'

Viewing 25 results - 101 through 125 (of 154 total)
  • Author
    Search Results
  • #174945
    iheartwine
    Participant

    I got rid the activity from the profile with this code:

    function bphelp_remove_groups_from_profile(){
    bp_core_remove_nav_item('activity');
    }
    add_action('bp_activity_setup_nav','bphelp_remove_groups_from_profile');

    but still looking for a solution to eliminate it from Group page

    #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?

    Grant Derepas
    Participant

    BP 1.6.5
    WP 3.5.1

    My buddypress environment has two distinct profile types set by an x-profile field.
    I’m using BP-Media which adds a media tab to a users menu
    I want to remove that tab from one profile types menus.
    I’m guessing I need to remove it from both the bp_is_my_profile() nav layout and the public nav layout…. When i try setting a global bp_core_remove_nav_item(‘media’) it removes it from other peoples pages but break my own profile

    Heres what I’ve got so far:

    
    //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');
    

    Direction, advice and comments appreciated!

    #157438
    daganread
    Participant

    Hello,

    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:)

    http://www.depthleadership.co.za is the website. I have wordpress WordPress 3.5.1. I have buddypress 1.6.4.

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

    i’m stuck because, if i make the conditional statement truthy the appropriate tab is removed. So i know i can remove nav tabs with this function. If i place the code too check if the member is a part of a certain group into something like header.php it works. BUT for some reason, together in my functions.php file they do not.

    I tried putting it into bp-custom.php, site just crashed.

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

    #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.

    in.arunava
    Participant

    I want to remove some menu links from my buddypress navigations. These menu’s are coming after installing corresponding plugins.

    My theme is not buddypress based, it’s now compatible using buddypress template pack plugin.

    I’ve tried various ways referred here & there in google but not working for me. please help!

    Suppose I am using classifieds plugin and want to remove it’s menu option from nav.

    tried to create bp-custom.php and placed on plugin directory

    `function boodle_remove_nav() {
    bp_core_remove_nav_item( ‘classifieds’ );
    }
    add_action( ‘bp_setup_nav’, ‘boodle_remove_nav’, 15 );`

    #143662
    modemlooper
    Moderator

    bp_core_remove_nav_item()

    Out-of-the-box, BP has a Send Invites link on the Groups forum. We don’t want that link unless you are a Group Admin or Group Moderator. Currently, we only have 1 private group set at this time with a group moderator. It is Group 17. But I know we will be getting more and more of these instances and I want to avoid hard coding the Groups each time to control the Send Invites link.

    See my code below from a plug-in I wrote:

    My plug-in:

    `
    function bbg_remove_send_invites_from_group() {

    if ($_SERVER == ‘123.456.789.10’) { // my test — does not work
    global $bp;
    $guid = $bp->group->id;
    echo ‘>>’.$guid.'<>’.bp_group_id().'<<';
    exit;
    }

    //bp_core_remove_nav_item( bp_get_current_group_slug(), ‘send-invites’ );
    $guid = ’17’; //Group ID for Bob’s Private Group
    if (is_site_admin()) return;
    elseif (groups_is_user_mod( get_current_user_id(), $guid ) == “1”) return;
    elseif (groups_is_user_admin( get_current_user_id(), $guid ) == “1”) return;
    else bp_core_remove_subnav_item( bp_get_current_group_slug(), ‘send-invites’ );
    }

    add_action( ‘bp_setup_nav’, ‘bbg_remove_send_invites_from_group’ );
    `

    #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.

    I have tried a variety of ways using `bp_core_remove_nav_item(){}` to remove the Send Invites menu item in a plug-in and in my theme’s functions.php file and I either get no success in removing certain menu items or I get a Page not found result.

    Does anyone know how to effectively remove sub nav menu items in Buddypress?

    Thanks

    This does not work in my functions.php:
    `function bbg_remove_send_invites_from_group() { bp_core_remove_nav_item( bp_get_current_group_slug(), ‘send-invites’ ); } add_action( ‘bp_setup_nav’, ‘bbg_remove_send_invites_from_group’ );`

    This does not work within a plugin:
    `function bbg_remove_send_invites_from_group() { bp_core_remove_nav_item( bp_get_current_group_slug(), ‘send-invites’ ); } add_action( ‘bp_setup_nav’, ‘bbg_remove_send_invites_from_group’ );`

    #27210
    seravifer
    Member

    I need to remove the user profiles tab:

    http://img521.imageshack.us/img521/2634/sinttulodi.png

    remove red

    this does not work in bp-costum.php
    <?php
    define ( ‘BP_DISABLE_ADMIN_BAR’, true );
    function bbg_remove_profile_tab() {
    bp_core_remove_nav_item( ‘profile’ );
    }
    add_action( ‘bp_setup_nav’, ‘bbg_remove_profile_tab’, 99 );
    ?>

    Oelita
    Member

    Hi,
    I searched the forum to find some informations about this, but I couldn’t quite gather it all.

    My problem : the Favorites subnav is part of the Activity tab, in the member page. I want to emphasize it by “upping” it to the upper level, besides the Profile and the Activity tabs.

    I found about the bp_core_new_nav_item and bp_core_remove_nav_item functions, and subnav ones. So, I should remove the favorites subnav of Activity nav, and create a Favorites nav, I guess ?
    But can a nav exist without any subnav ?
    And what screen_function must I give to this new nav (or single subnav, if a nav can’t exist without subnavs) to use existing favorites page, and not a custom one ? (I just want to move it)

    I hope I’m clear, and I thank you for your help.

    Sameera
    Member

    Hi,
    I want to hide the “Friends” tab on the users profile page to all other users except for admin and owner of the profile only. I want this to work the way Messages and Settings tabs work => If another user types
    `http: // [site] / [username] / messages`
    BP shows an error message saying the user does not have access to the page.

    If I use (with !bp_is_my_profile()),
    `bp_core_remove_nav_item(‘friends’)`
    it just shows a 404 type page for the `http: // [site] / [username] / friends`.

    I tried
    `$bp->bp_nav = false;`
    but that doesn’t prevent the user from seeing the friends by going to `http: // [site] / [username] / friends`

    I prevent the user from seeing the friends list by editing the members/home.php file. But, I’d like to use the same mechanism that settings and messages pages use.
    I looked at messages/single.php, but didn’t see anything that could be taking care of this logic.

    Can anybody help please?

    #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

    #25468
    leethompson
    Member

    Hello Everyone,
    I am trying to move some links around from the main Nav to the sub nav ie:
    sub of Profile
    Privacy
    Settings

    Sub of MyGroups
    Create

    I have added the following code to my themes function.php and it moves the links as I want, but the first part bp_core_remove_nav_item seems to disable the page load.

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

    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’ => ‘xprofile_screen_edit_profile_mmc’,
    ‘position’ => 30,
    ‘item_css_id’ => ‘home’ ) );

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

    }
    }
    add_action(‘groups_setup_nav’, ‘bp_add_create_group_subnav’);
    `
    I was wondering what I am doing wrong?

    thanks in advance.

Viewing 25 results - 101 through 125 (of 154 total)
Skip to toolbar