Hi, You could try this:
function bpven_set_member_default_nav() {
if ( ! bp_is_user_profile() && ! bp_is_user_activity() && ! bp_is_user() ) {
return;
}
if ( bp_displayed_user_id() != bp_loggedin_user_id() ){
return;
}
bp_core_new_nav_default( array(
'parent_slug' => buddypress()->activity->id,
// other "activity" sub_nav slugs : personal favorites friends groups mentions
'subnav_slug' => 'friends',
'screen_function' => 'bp_activity_screen_friends'
)
);
}
add_action( 'bp_setup_nav', 'bpven_set_member_default_nav', 20 );
Hi Venutius,
Thank you so much for your reply.
I just added it the the bp-custom file but unfortunately, it didn’t seem to work.
My profile page returned nothing (just header and footer of the page)
Ah sorry, there was a typo, I’ve corrected it now
Great, thanks.
But now, the personal tab redirects to friends. It means that there is no way to access the personal tab. As such, there is no “status update” box anymore.
Thanks again for your time!
My dev friend said to say this:
“When you set bp_core_new_nav_default to friends tab, you are no longer able to access personal tab since it also keep using the default url slug.”
And this code:
function add_settings_subnav_tab() {
if ( bp_is_my_profile() ) {
buddypress()->members->nav->edit_nav(array(
'position' => 9,
), 'friends', 'activity');
global $bp;
bp_core_new_nav_default(array( 'parent_slug' => $bp->activity->slug, 'screen_function' => 'bp_activity_screen_friends', 'subnav_slug' => $bp->friends->slug));
} else {
buddypress()->members->nav->edit_nav(array(
'position' => 10,
), 'friends', 'activity');
}
}
add_action( 'bp_setup_nav', 'add_settings_subnav_tab', 100 );
Thanks for that Boris,
I’ve updated this to fix the persoal issue and also add the what’s new tab to all activity tabs
function add_settings_subnav_tab() {
if ( bp_is_my_profile() ) {
$displayed_user_id = bp_displayed_user_id();
buddypress()->members->nav->edit_nav(array(
'position' => 9,
), 'friends', 'activity');
global $bp;
bp_core_new_nav_default(array(
'parent_slug' => $bp->activity->slug,
'screen_function' => 'bp_activity_screen_friends',
'subnav_slug' => $bp->friends->slug));
bp_core_remove_subnav_item( 'activity', 'just-me' );
bp_core_new_subnav_item( array(
'name' => sanitize_text_field( __( 'Personal', 'bp-profile-activity-wall' ) ),
'slug' => 'just-me',
'parent_url' => bp_core_get_user_domain( $displayed_user_id ) . 'activity/',
'parent_slug' => 'activity',
'screen_function' => 'bp_activity_screen_my_activity',
'position' => 10
) );
} else {
buddypress()->members->nav->edit_nav(array(
'position' => 10,),
'friends', 'activity');
}
}
add_action( 'bp_setup_nav', 'add_settings_subnav_tab', 100 );
function bpven_load_mention_me() {
$displayed_user_id = bp_displayed_user_id();
$currentpage = $_SERVER['REQUEST_URI'];
if ( bp_is_activity_component() && strpos( $currentpage, 'just-me' ) === false ) {
$_GET['r'] = bp_activity_get_user_mentionname( $displayed_user_id );
bp_get_template_part( 'activity/post-form' );
}
}
add_action( 'bp_before_member_body', 'bpven_load_mention_me' );
wow, it’s incredible.
Works perfectly. Thank you so much 🙂