Search Results for 'bp_core_remove_nav_item'
-
Search Results
-
Topic: Remove Profile Nav Items
I want to remove certain navigation items from user profiles.
However if I use this line, it also removes them from the main menu.
bp_core_remove_nav_item( 'settings' );
I need the items on the main menu, but i want them removed from the user profile.
Anyway to do that?
For privacy issues I want to hide certain links on profile view.
i use the snippet, mentioned here (see script below):
oneThis works fine with BP related links, but I cannot hide links from CPT like rtMedia and the link of this:
`function bp_postsonprofile() {
add_action( ‘bp_template_content’, ‘profile_screen_posts_show’ );
bp_core_load_template( apply_filters( ‘bp_core_template_plugin’, ‘members/single/plugins’ ) );
}function profile_screen_posts_show() {
$myposts = get_posts( array(
‘posts_per_page’ => -1,
‘author’ => bp_displayed_user_id(),
‘post_type’ => ‘post’
));if( ! empty($myposts) ) {
echo ‘<ul>’;
foreach($myposts as $post) {
setup_postdata( $post );
echo ‘<li><a href=”‘ . get_permalink($post->ID) . ‘”>’ . get_the_title($post->ID) . ‘</a></i>’;
}echo ‘</ul>’;
wp_reset_postdata();
} else {
echo ‘<div class=”info” id=”message”><p>’. bp_displayed_user_fullname() .’ hat keine Beiträge veröffentlicht.</p></div>’;
}
}add_action ( ‘profile_screen_posts_show’ );`
function bpfr_hide_tabs() {
global $bp;
/**
* class_exists() & bp_is_active are recommanded to avoid problems during updates
* or when Component is deactivated
*/if( class_exists( ‘bbPress’ ) || bp_is_active ( ‘groups’ ) ) :
/** here we fix the conditions.
* Are we on a profile page ? | is user site admin ? | is user logged in ?
*/
if ( bp_is_user() && !is_super_admin() && !is_user_logged_in() ) {/* and here we remove our stuff ! */
bp_core_remove_nav_item( ‘activity’ );
bp_core_remove_nav_item( ‘friends’ );
bp_core_remove_nav_item( ‘groups’ );
bp_core_remove_nav_item( ‘posts’ );
bp_core_remove_nav_item( ‘forums’ );
bp_core_remove_nav_item( ‘media’ );
}
endif;
}
add_action( ‘bp_setup_nav’, ‘bpfr_hide_tabs’, 15 );I currently used this method first, which wasn’t working for me:
$bp->bp_nav['settings'] = false;
Then I used this snippet instead, which happened to work, but unfortunately removed the nav items from my main menu as well instead of just the BuddyPress profile fields:
function my_remove_em_nav() { global $bp; bp_core_remove_nav_item( 'settings' ); } add_action( 'bp_init', 'my_remove_em_nav' );
Any idea on how to make it so it only removes the items from the profile fields rather than all the nav menus in general?
Hello,
How to hide the button “Members” in the display of a group?
https://screenshots.firefox.com/4fhh6NF0U12mYFQu/nullThe following code does not work:
function bpex_hide_members_menu_tabs() { if ( bp_is_group() ) { if ( is_super_admin() ) return ; bp_core_remove_nav_item('members'); } }
Regards
Topic: Move subnav to other tab
Hello,
There are many examples to hide the navigation on a profile bp_core_remove_nav_item(‘friends’ );.
How to hide tabs on the Sitewide Activity page ?Regards
I got rid of the profile tab with this:
function bphelp_remove_activity_from_profile(){
bp_core_remove_nav_item(‘activity’);
}
add_action(‘bp_activity_setup_nav’,’bphelp_remove_activity_from_profile’);I can’t figure out how to remove friends and messages. I have tried this which doesn’t work:
function bphelp_remove_friends_nav() {
bp_core_remove_nav_item( bp_friends_slug() );
}
add_action( ‘bp_setup_nav’, ‘bphelp_remove_friends_nav’ );Any suggestions?
Topic: Hiding Menu by User Role
Hey guys,
first of all, awesome forum! I’ve already solved so many of my issues simply by reading the many helpful answers – hence never had the need to post anything myself, but now I’m a bit stuck.
Here’s what I wanted to do: Put a new profile group in a separate bp profile menu tab and make it visible to both, logged in as well as logged out users. Now, it works perfectly fine, except for the fact that logged out users for some reason get to see my personal profile group under my custom tab instead of the new profile group – which is displayed correctly for me as well as other logged in users.
Here’s my code:
/** BP Profile Tab Visibility */ function bpfr_hide_top_nav() { if( !is_user_logged_in() ) { // bp topnav items to hide bp_core_remove_nav_item( 'activity' ); bp_core_remove_nav_item( 'friends' ); bp_core_remove_nav_item( 'groups' ); bp_core_remove_nav_item( 'forums' ); bp_core_remove_nav_item( 'media' ); bp_core_remove_nav_item( 'docs' ); bp_core_remove_nav_item( 'location' ); //bp subnav (my activities, my groups, etc) bp_core_remove_subnav_item( 'activity', 'activity' ); bp_core_remove_subnav_item( 'activity', 'friends' ); bp_core_remove_subnav_item( 'activity', 'favorites' ); bp_core_remove_subnav_item( 'activity', 'groups' ); bp_core_remove_subnav_item( 'activity', 'mentions' ); bp_core_remove_subnav_item( 'activity', 'media' ); bp_core_remove_subnav_item( 'activity', 'docs' ); bp_core_remove_subnav_item( 'activity', 'comments' ); } } add_action( 'bp_ready', 'bpfr_hide_top_nav', 10 ); /** BP Tab Order Profile and Tab Rename */ function bpex_primary_nav_tabs_position() { buddypress()->members->nav->edit_nav( array( 'position' => 2, ), 'activity' ); buddypress()->members->nav->edit_nav( array( 'position' => 1, ), 'profile' ); buddypress()->members->nav->edit_nav( array( 'position' => 3, ), 'messages' ); buddypress()->members->nav->edit_nav( array( 'position' => 4, ), 'notifications' ); buddypress()->members->nav->edit_nav( array( 'position' => 5, ), 'friends' ); buddypress()->members->nav->edit_nav( array( 'position' => 6, ), 'groups' ); buddypress()->members->nav->edit_nav( array( 'position' => 7, ), 'forums' ); buddypress()->members->nav->edit_nav( array( 'position' => 8, ), 'criticalreview' ); buddypress()->members->nav->edit_nav( array( 'position' => 9, ), 'docs' ); buddypress()->members->nav->edit_nav( array( 'position' => 10, ), 'media' ); buddypress()->members->nav->edit_nav( array( 'position' => 11, ), 'location' ); buddypress()->members->nav->edit_nav( array( 'position' => 12, ), 'orders' ); buddypress()->members->nav->edit_nav( array( 'position' => 13, ), 'settings' ); } add_action( 'bp_setup_nav', 'bpex_primary_nav_tabs_position', 999 ); /** Put Critical Review Profile Group in BP Tab */ function buddydev_modifyy_user_profile_tab() { bp_core_new_nav_item( array( 'name' => 'Critical Review', 'slug' => 'criticalreview', 'screen_function' => 'buddydev_screen_profile_data', 'default_subnav_slug' => 'criticalreview-sub', 'show_for_displayed_user' => true, )); } add_action( 'bp_setup_nav', 'buddydev_modifyy_user_profile_tab', 8 ); function buddydev_screen_profile_data() { //filter loop add_filter( 'bp_after_has_profile_parse_args', 'buddydev_filter_args_for_profile_group' ); //load loop add_action( 'bp_template_content', 'buddydev_show_profile_group_data'); bp_core_load_template( 'members/single/plugins'); } function buddydev_filter_args_for_profile_group( $args ) { ///CHANGE IT $args['profile_group_id'] = '6'; //Your Profile Group ID Here return $args; } //Load the loop function buddydev_show_profile_group_data() { $profileslug = bp_get_profile_slug(); // if ( bp_is_my_profile() ) : // echo "Edit under Profile"; // endif; bp_get_template_part( 'members/single/profile/profile-loop' ); } function hide_profile_group( $grpid ) { if ( is_user_logged_in() && !bp_is_profile_edit() ) { $myfield = xprofile_get_field_data( 'Critical Review' ); $grpid['exclude_groups'] = '6'; } return $grpid; } add_filter( 'bp_after_has_profile_parse_args', 'hide_profile_group' );
A few comments:
Most of the essential code is based on this threat. I am not really a coder myself, but usually I understand what the functions are doing.
For now I commented `// if ( bp_is_my_profile() ) :
// echo “Edit under Profile”;
// endif;` out, because if I leave it in, for some reason then also logged-in users only see the personal profile group instead of the Critical Review one?!Also, I’m not entirely sure about the use of the last function and its use / relevance, because it doesn’t seem to affect anything. This might however have to do with the fact that in order to avoid duplication of the Critical Review profile group under the actual profile tab, I’ve hidden the profile group via CSS.
Finally, I’m running the latest WP and BP installs and you can have a look at the described behavior here. Interestingly, as you can see in this instance, the profile fields are actually adjusted to my CSS for the Critical Review profiles group – but the actual content doesn’t show correctly.
Now, if any of you could help me out, I would highly appreciate it!
Thank you so much in advance! 🙂