Tagged: profile
How do you change the default profile screen to go to the Edit Profile when a user clicks on their own profile?
Hello Lisa,
Please use the following code:
/** * Override default nav profile. */ function buddydev_set_profile_default_nav() { if ( ! bp_is_my_profile() ) { return; } add_filter( 'bp_do_redirect_canonical', '__return_false' ); bp_core_new_nav_default( array( 'parent_slug' => bp_get_profile_slug(), 'subnav_slug' => 'edit', 'screen_function' => 'xprofile_screen_edit_profile', ) ); // Determine user to use. if ( bp_displayed_user_domain() ) { $user_domain = bp_displayed_user_domain(); } elseif ( bp_loggedin_user_domain() ) { $user_domain = bp_loggedin_user_domain(); } else { return; } $slug = bp_get_profile_slug(); $profile_link = trailingslashit( $user_domain . $slug ); bp_core_new_subnav_item( array( 'name' => _x( 'View', 'Profile header sub menu', 'buddypress' ), 'slug' => 'public', 'parent_url' => $profile_link, 'parent_slug' => bp_get_profile_slug(), 'screen_function' => function () { xprofile_screen_display_profile(); }, 'position' => 10, ) ); } add_action( 'bp_setup_nav', 'buddydev_set_profile_default_nav', 20 );
Please do let me know if it works or not.
Regards
Ravi
Viewing 4 posts - 1 through 4 (of 4 total)
The topic ‘ [Resolved] Default Profile Screen’ is closed to new replies.
This topic is: resolved