Skip to:
Content
Pages
Categories
Search
Top
Bottom

Default Landing group while editing Member profile


  • amkh
    Participant

    @amkh

    Hi,

    Can anyone please help me with this. I do not want members to modify the registration details once after they have registered. Hence I have hidden the first group (group 1) in Profile > Edit. But I noticed that whenever the member edits his profile to update fields in other profile groups then by default he lands into group 1 which is empty in my case. Can anyone help me to change the default landing page to group 2 instead?

Viewing 6 replies - 1 through 6 (of 6 total)

  • Prashant Singh
    Participant

    @prashantvatsh


    amkh
    Participant

    @amkh

    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.


    Bit Boy
    Participant

    @bitboy

    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.


    Prashant Singh
    Participant

    @prashantvatsh

    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


    amkh
    Participant

    @amkh

    Hi BitBoy & Prashant,

    Both of your code works perfectly. Thank you very much both of you.


    Prashant Singh
    Participant

    @prashantvatsh

    Welcome 🙂

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
Skip to toolbar