Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'bp_get_displayed_user_nav'

Viewing 25 results - 1 through 25 (of 90 total)
  • Author
    Search Results
  • #324968
    webinbox
    Participant

    Hello,
    i cant get profile/member links working on main activity page /activity. On profile pages etc member links are working just fine. Created new sidebar with call:

    
    bp_get_displayed_user_nav(); 
    /**
    * Fires after the display of member options navigation.
    *
    * @since 1.2.4
    */
    do_action( 'bp_member_options_nav' );
    

    It displays menu items, label links but if you are on acitivity stream page links are wrong. Is there a way to fix that? I can create wp_menu there but then i will loose small annotations with numbers inside (friends number etc).

    Also how to detect if i am on main activity stream page. I know there is

    
    bp_is_current_component('activity')
    

    but it detects both main streams and member activity stream.

    Thank you.

    #322734
    Mike Witt
    Participant

    OK, well it appears that there is actually no BP template that can be overridden for this situation. I ended up doing it by filtering the code that creates the Friends Tab in the profile. Here’s what I ended up with. If anybody sees anything wrong here, let me know. All this does is create the same tab (a list item) that BP does, except I don’t include the count.

    function filter_bp_friends_tab( $args ) {
        $new_args = '<li id="friends-personal-li" >'
            . '<a id="user-friends" '
            . 'href="' . bp_get_displayed_user_link() . 'friends/">'
            . 'Friends</a></li>';
        return( $new_args );
    }
    add_filter('bp_get_displayed_user_nav_friends', 'filter_bp_friends_tab'); 

    note that the functions like bp_get_displayed_user_link() are defined in the buddypress filebp-members/bp-members-template.php

    #278493
    shanebp
    Moderator

    Did you try just removing the calls to the nav from the template ?

    Since you mention ‘Member primary navigation’, I’ll assume you are working the bp-legacy templates.

    Open buddypress\bp-templates\bp-legacy\buddypress\members\single\home.php
    Remove: bp_get_displayed_user_nav();
    And perhaps: do_action( 'bp_member_options_nav' );

    #276726
    Prashant Singh
    Participant

    Needs more debugging, please try just after or before <?php bp_get_displayed_user_nav(); ?>

    Thanks

    #276684
    israel4lincelot
    Participant

    Hi!

    I’m having some hard time with the following:

    I want to place my profile avatar (item-header-avatar) from the header to the left from my item-nav and eventually delete the header section.

    I’m editing the member-header.php file through my child-theme ( using Kleo-theme ). I thought it would be as easy as copying the div from item-header-avatar and pasting it after <ul class=”responsive-tabs”> but after loading the webpage it does not work.

    So my code looks like this:


    <?php

    /**
    * Fires after the display of a member's header.
    *
    * @since 1.2.0
    */
    do_action( 'bp_after_member_header' ); ?>

    <?php if ( sq_option( 'bp_nav_overlay', 0 ) == 1 ) : ?>
    <div id="item-nav">
    <div class="item-list-tabs no-ajax" id="object-nav" aria-label="<?php esc_attr_e( 'Member primary navigation', 'buddypress' ); ?>" role="navigation">
    <ul class="responsive-tabs">
    <div id="item-header-avatar" class="rounded">
    ">

    <?php bp_displayed_user_avatar( 'type=full' ); ?>


    <?php do_action('bp_member_online_status', bp_displayed_user_id()); ?>
    </div><!-- #item-header-avatar -->

    <?php bp_get_displayed_user_nav(); ?>

    <?php

    /**
    * Fires after the display of member options navigation.
    *
    * @since 1.2.4
    */
    do_action( 'bp_member_options_nav' ); ?>

    </div>
    </div>
    <!-- #item-nav -->
    <?php endif; ?>

    Thankyou!!

    #266025
    Henry Wright
    Moderator

    The easiest way to do this is to edit the home.php file. You’ll need to comment out bp_get_displayed_user_nav() and the related markup.

    Ref: your-child-theme/buddypress/members/single/home.php

    #263040
    danbp
    Participant
    #257584
    danbp
    Participant

    Hi @nabilyazghi,

    You could perhaps use something like this:

    function blabla() {
         if ( ! bp_is_my_profile() ) 
    	$nav_array = 'what_you_need';
    
         return $nav_array;
    }
    add_filter('bp_get_displayed_user_nav', 'blabla', 10, 1 );

    Function ref: http://hookr.io/plugins/buddypress/2.4.3/functions/bp_get_displayed_user_nav/

    #247637
    shanebp
    Moderator

    For standard BP profile tabs, try:

    function zhubr_remove_profile_nav_item( $nav ) { 
    	
        if ( ! bp_is_my_profile() )
    	$nav = '';
    		
        return $nav;
    }
    add_filter('bp_get_displayed_user_nav_notifications', 'zhubr_remove_profile_nav_item', 20, 1 );
    add_filter('bp_get_displayed_user_nav_groups', 'zhubr_remove_profile_nav_item', 20, 1 );
    // add additional calls for other tabs

    To remove custom tabs, try:

    function zhubr_remove_custom_profile_tab() {
    	
        if ( bp_is_user() && ! bp_is_my_profile() )
    	bp_core_remove_nav_item( 'events' );
    	
    }
    add_action( 'bp_ready', 'zhubr_remove_custom_profile_tab', 25 );
    #244990
    shanebp
    Moderator

    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.

    #244688
    danbp
    Participant

    See here:

    Filters & Constants Reference

    About bp_get_displayed_user_nav_ As you see, there is a a final undescore
    This is a dynamic function name which need to be completed, depending the place you want it to be modified.
    bp_get_displayed_user_nav_<css_id>.

    bp_get_displayed_user_nav_<css_id>

    See a working example here, to understand how to use it
    https://buddypress.org/support/topic/how-to-remove-sub-nav-only-for-displayed-user/#post-234852

    #241218
    danbp
    Participant

    @quinngoldwin

    it goes to my personal activity instead.

    It’s intended so ! You’re on a profile page, and any links added directly to buddybar or his subnav is alwways, and only, user related. It’s a contextual menu.

    But you can use bp_member_options_nav action hook which is on the template.
    bp-templates/bp-legacy/buddypress/members/single/home.php

    Add this snippet to bp-custom.php your your child theme functions.php:

    
    function goldwin_custom_setup_nav() {
      if ( bp_is_active( 'xprofile' ) )
    ?>
    <li><a href="<?php bp_activity_directory_permalink(); ?>"><?php printf ('All Activities'); ?></a></li>
    <?php  
    }
    add_action( 'bp_member_options_nav', 'goldwin_custom_setup_nav' );

    By default, the hook is placed as latest item of the navbar items. To get as first item, simply move the action at the begin of the list.

    Default code looks like this:

    
    <ul>
    
    <?php bp_get_displayed_user_nav(); ?>
    
    <?php do_action( 'bp_member_options_nav' ); ?>
    
    </ul>

    that you can chage to:

    <ul>
    
    <?php do_action( 'bp_member_options_nav' ); ?>
    
    <?php bp_get_displayed_user_nav(); ?>
    
    </ul>

    But you can’t get your custom item as second, or third, or whatever. Only first or latest.

    How to use bp-custom, functions.php and child_theme is explained on the codex.

    #237808
    shanebp
    Moderator

    ‘Activity’ is the default tab.
    If you want to remove it, you need to change the default tab.

    Change Default Members Profile Landing Tab

    define('BP_DEFAULT_COMPONENT', 'profile' );
    
    function klosurdo_remove_member_nav($nav_array) { 
    	
    	if( !is_user_logged_in() ) 
    		$nav_array = '';
    		
    	return $nav_array;
    }
    add_filter('bp_get_displayed_user_nav_activity', 'klosurdo_remove_member_nav', 15, 1 );
    #234852
    shanebp
    Moderator

    What plugin are you using to enable ‘followers’ ?
    What version of BP are you using?

    You could try this:

    function addy_remove_profile_nav($nav_array) {
    
         if( is_super_admin() ) 
              return $nav_array;
    
         if ( ! bp_is_my_profile() )
    	$nav_array = '';
    
         return $nav_array;
    }
    add_filter('bp_get_displayed_user_nav_followers', 'addy_remove_profile_nav', 10, 1 );
    #233516
    fanmusic
    Participant

    Hi,

    Actually no, thats not it, there is no option for that in buddypress, I need to hide the buttons notifications and settings (that are along with profile, messages groupes etc.)
    it’s in the front office.

    thanks a lot

    PS : someone posted this, I think it’s on the right track but it doesn’t work :/
    [ edited – please use ‘code’ button when posting code ]
    Try this in bp-custom.php

    function fanmusic_remove_profile_nav_remove( $nav ) { 
            
         $nav = '';
                    
         return $nav;
    }
    add_filter('bp_get_displayed_user_nav_notifications', 'fanmusic_remove_profile_nav_remove', 10, 1 );
    add_filter('bp_get_displayed_user_nav_settings', 'fanmusic_remove_profile_nav_remove', 10, 1 );
    #229903
    miama
    Participant
    
    
    <?php
    
    /**
    * BuddyPress – Users Home
    *
    * @package BuddyPress
    * @subpackage bp-default
    */
    
    //get theme options
    global $oswc_bp;
    
    //set theme options
    $oswc_bp_sidebar_unique = $oswc_bp[‘bp_sidebar_unique’];
    $oswc_bp_members_sidebar_unique = $oswc_bp[‘bp_members_sidebar_unique’];
    
    //setup variables
    $sidebar=”Default Sidebar”;
    if($oswc_bp_sidebar_unique) { $sidebar=”BuddyPress Default Sidebar”; }
    if($oswc_bp_members_sidebar_unique) { $sidebar=”BuddyPress Members Sidebar”; }
    
    get_header( ‘buddypress’ ); ?>
    
    <div class=”main-content-left”>
    
    <div class=”page-content” id=”content”>
    
    <?php do_action( ‘bp_before_member_home_content’ ); ?>
    
    <div id=”item-header” role=”complementary”>
    
    <?php locate_template( array( ‘members/single/member-header.php’ ), true ); ?>
    
    </div><!– #item-header –>
    
    <div id=”item-nav”>
    <div class=”item-list-tabs no-ajax” id=”object-nav” role=”navigation”>
    
        <?php bp_get_displayed_user_nav(); ?>
    
        <?php do_action( ‘bp_member_options_nav’ ); ?>
    
    </div>
    </div><!– #item-nav –>
    
    <div id=”item-body”>
    
    <?php do_action( ‘bp_before_member_body’ );
    
    if ( bp_is_user_activity() || !bp_current_component() ) :
    locate_template( array( ‘members/single/activity.php’ ), true );
    
    elseif ( bp_is_user_blogs() ) :
    locate_template( array( ‘members/single/blogs.php’ ), true );
    
    elseif ( bp_is_user_friends() ) :
    locate_template( array( ‘members/single/friends.php’ ), true );
    
    elseif ( bp_is_user_groups() ) :
    locate_template( array( ‘members/single/groups.php’ ), true );
    
    elseif ( bp_is_user_messages() ) :
    locate_template( array( ‘members/single/messages.php’ ), true );
    
    elseif ( bp_is_user_profile() ) :
    locate_template( array( ‘members/single/profile.php’ ), true );
    
    elseif ( bp_is_user_forums() ) :
    locate_template( array( ‘members/single/forums.php’ ), true );
    
    elseif ( bp_is_user_settings() ) :
    locate_template( array( ‘members/single/settings.php’ ), true );
    
    elseif ( bp_is_user_notifications() ) :
    locate_template( array( ‘members/single/notifications.php’ ), true );
    // If nothing sticks, load a generic template
    else :
    locate_template( array( ‘members/single/plugins.php’ ), true );
    
    endif;
    
    do_action( ‘bp_after_member_body’ ); ?>
    
    </div><!– #item-body –>
    
    <?php do_action( ‘bp_after_member_home_content’ ); ?>
    
    </div>
    
    </div>
    
    <div class=”sidebar”>
    
    <?php if ( function_exists(‘dynamic_sidebar’) && dynamic_sidebar($sidebar) ) : else : ?>
    
    <div class=”widget-wrapper”>
    
    <div class=”widget”>
    
    <div class=”section-wrapper”><div class=”section”>
    
    <?php _e(‘ Made Magazine ‘, ‘made’ ); ?>
    
    </div></div>
    
    <div class=”textwidget”>
    
    <p><?php _e( ‘This is a widget panel. To remove this text, login to your WordPress admin panel and go to Appearance >> Widgets, and drag & drop a widget into the corresponding widget panel.’, ‘made’ ); ?></p>
    
    </div>
    
    </div>
    thats what I did:
    </div>
    
    <?php endif; ?>
    
    </div>
    
    <br class=”clearer” />
    
    <?php get_footer( ‘buddypress’ ); ?>
    
    shanebp
    Moderator

    You’re looking at the templates that render the content for tabs.
    But you want to remove tabs.
    Because ‘groups’ may be the only tab available, you need to make ‘groups’ the default component.
    You may need to add or remove one or more add_filter calls depending on your installation.
    Try this in your bp-custom.php file:

    
    define( 'BP_DEFAULT_COMPONENT', 'groups' );
    
    function izzy_adjust_profile_nav() {
      if ( ! is_user_logged_in() ) {
    	add_filter('bp_get_displayed_user_nav_activity', 'izzy_profile_nav_remove', 10, 1 );
    	add_filter('bp_get_displayed_user_nav_friends', 'izzy_profile_nav_remove', 10, 1 );
    	add_filter('bp_get_displayed_user_nav_forums', 'izzy_profile_nav_remove', 10, 1 );	
    	add_filter('bp_get_displayed_user_nav_xprofile', 'izzy_profile_nav_remove', 10, 1 );	
      }
    }
    add_action( 'bp_init', 'izzy_adjust_profile_nav' );
    
    function izzy_profile_nav_remove($nav_array) { 
      $nav_array = '';
      return $nav_array;
    }
    #164167
    nsbrown
    Participant

    I’ve had to another route, I’m trying to add a logged in users nav into all pages, I can do this by adding this code to my page template:

    <div class=”left-nav”>
    <?php bp_get_displayed_user_nav(); ?>
    <?php do_action( ‘bp_get_options_nav’ ); ?>
    </div>

    But all the links then rendered are relative it doesn’t work, is there a way of making this work globally?

    #145493
    Tammie Lister
    Moderator

    Links are added either by a plugin or by hooking into that menu.

    https://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/how-to-remove-and-add-items-in-bp_get_displayed_user_nav/ is quite a useful thread on adding to menus.

    As for deleting the sidebar, that would need a link to see your theme before saying if something was going to work or not.

    r-a-y
    Keymaster

    You’ll want to take a look at the bp_get_displayed_user_nav() function.

    There’s a filter there that applies to each menu item, which you can hook into and override.

    Tammie Lister
    Moderator
    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

    r-a-y
    Keymaster

    You’d need to get rid of `bp_get_displayed_user_nav()` and `bp_get_options_nav()` from your BP templates specifically in the /members/single/ folder of your theme.

    #120403
    exceil
    Member

    p.s im quite noob in programming :D

    #120402
    exceil
    Member

    Hi !
    I want to do the same thing what you defunctlif but i have a problem. I created bp-custom.php file with your settings and put it in buddypress main directory and it doesn’t work :( should i put it somewhere else?

Viewing 25 results - 1 through 25 (of 90 total)
Skip to toolbar