Search Results for 'bp_get_displayed_user_nav'
-
AuthorSearch Results
-
June 13, 2022 at 11:28 am #324968
Topic: Activity Stream and profile links
in forum How-to & Troubleshootingwebinbox
ParticipantHello,
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.
January 3, 2022 at 9:54 pm #322734In reply to: Overriding number of Friends in the Profile
Mike Witt
ParticipantOK, 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.phpOctober 11, 2018 at 4:26 pm #278493In reply to: Getting rid of ‘Member primary navigation’
shanebp
ModeratorDid 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' );September 25, 2018 at 8:10 am #276726In reply to: Placing profile avatar in item-nav
Prashant Singh
ParticipantNeeds more debugging, please try just after or before
<?php bp_get_displayed_user_nav(); ?>Thanks
September 24, 2018 at 11:30 am #276684Topic: Placing profile avatar in item-nav
in forum How-to & Troubleshootingisrael4lincelot
ParticipantHi!
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!!
May 16, 2017 at 8:09 pm #266025In reply to: Hide nav bar on profile
Henry Wright
ModeratorThe 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
January 20, 2017 at 8:54 am #263040In reply to: How to edit Profile menu?
danbp
ParticipantWhen you have such basic question, please search first the forum and read the documentation.
https://buddypress.org/support/search/bp_get_displayed_user_nav/
http://stackoverflow.com/questions/23041165/buddypress-custom-nav-and-page-templateAugust 13, 2016 at 8:21 am #257584In reply to: Get the user nav in a separate page
danbp
ParticipantHi @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/
December 10, 2015 at 8:56 pm #247637In reply to: Buddypress privacy for tabs
shanebp
ModeratorFor 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 tabsTo 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 );October 1, 2015 at 10:41 pm #244990In reply to: Hide profile tabs on user roles
shanebp
ModeratorUntested, 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.
September 22, 2015 at 3:32 pm #244688In reply to: Customizing Members Profile Link Structure
danbp
ParticipantSee here:
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>.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-234852June 28, 2015 at 5:14 pm #241218In reply to: show entire activity stream – global activity stream
danbp
Participantit 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_navaction hook which is on the template.
bp-templates/bp-legacy/buddypress/members/single/home.phpAdd 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.
April 13, 2015 at 11:54 am #237808In reply to: Remove member activity stream from profile nav bar
shanebp
Moderator‘Activity’ is the default tab.
If you want to remove it, you need to change the default 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 );February 20, 2015 at 2:21 pm #234852In reply to: How to remove sub nav only for displayed user
shanebp
ModeratorWhat 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 );February 3, 2015 at 9:15 pm #233516In reply to: in profile hide notifications and settings
fanmusic
ParticipantHi,
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.phpfunction 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 );November 29, 2014 at 10:44 am #229903In reply to: [Resolved] Notification – what's wrong here?
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’ ); ?>November 28, 2014 at 3:54 pm #229833shanebp
ModeratorYou’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 moreadd_filtercalls 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; }May 17, 2013 at 4:02 pm #164167In reply to: Unable to overwrite activity directory
nsbrown
ParticipantI’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?
November 22, 2012 at 10:04 am #145493In reply to: how to delete this menu top links
Tammie Lister
ModeratorLinks 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.
September 19, 2012 at 11:49 pm #142122r-a-y
KeymasterYou’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.
July 25, 2012 at 10:42 am #137950Tammie Lister
ModeratorOk, this forum post goes into adding and removing here https://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/how-to-remove-and-add-items-in-bp_get_displayed_user_nav/
November 3, 2011 at 1:29 pm #123676leethompson
MemberThis 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
September 27, 2011 at 6:39 pm #121288r-a-y
KeymasterYou’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.
September 21, 2011 at 11:51 am #120403In reply to: [Resolved] Customizing bp_get_displayed_user_nav()
exceil
Memberp.s im quite noob in programming
September 21, 2011 at 11:50 am #120402In reply to: [Resolved] Customizing bp_get_displayed_user_nav()
exceil
MemberHi !
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? -
AuthorSearch Results