Thank you very much for the link. Since I always need my landing group to be 2 hence I added this to “Edit.php”
bp_core_redirect($bp->displayed_user->domain.”profile/edit/group/2″);
But it does not work. When I do edit profile I do not see any group tabs / links. They all vanish. The slug in the URL shows group 1 and not 2.
Hi,
Here is another approach to solve the same issue.
/**
* Change the profile edit landing group tab.
*/
function bitboy_change_landing_profile_group() {
// are we on edit profile?
if ( ! bp_is_user_profile_edit() || ! bp_is_my_profile() ) {
return;
}
$group_id = 2;
// Make sure a group is set.
if ( ! bp_action_variable( 1 ) ) {
bp_core_redirect( trailingslashit( bp_displayed_user_domain() . bp_get_profile_slug() . '/edit/group/'. $group_id ) );
}
}
add_action( 'bp_screens', 'bitboy_change_landing_profile_group', 2 );
This does not requore any change in any template file.
function ps_change_default_profile_group() {
if ( ! bp_is_user_profile_edit() || ! bp_is_my_profile() ) {
return;
}
$group_id = 2;
if ( bp_get_current_profile_group_id()==1 ) {
bp_core_redirect(bp_displayed_user_domain()."profile/edit/group/2/");
}
}
add_action( 'get_header', 'ps_change_default_profile_group', 1 );
Hi, please remove what you did in edit.php and use this code. Try pasting this in bp-custom.php file. If not able to create then add a plugin called Code Snippets https://wordpress.org/plugins/code-snippets/ and then add a snippet and paste the code there.
Thanks
Hi BitBoy & Prashant,
Both of your code works perfectly. Thank you very much both of you.