BuddyDev

Search

[Resolved] Directed back to profile after edit

  • Participant
    Level: Yogi
    Posts: 1117
    calu on #43243

    Hi there, after a user has edited their profile, they are redirected back to the edit profile page:

    https://domain/user/profile/edit/group//

    Instead it would be more logic, if they are directed to their profile instead:

    https://domain/user/

    Do you have a code snippet for this action?

    Regards
    Carsten

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on #43281

    Hello Carsten,

    Check the following code:

    
    add_action( 'xprofile_updated_profile', function ( $user_id, $posted_field_ids, $errors ) {
    
        if ( ! $errors ) {
            bp_core_add_message( __( 'Changes saved.', 'buddypress' ) );
            bp_core_redirect( bp_core_get_user_domain( $user_id ) . bp_get_profile_slug() );
        }
    
    }, 10, 3 );
    
    

    But it is not a good user experience.

    Regards
    Ravi

  • Participant
    Level: Yogi
    Posts: 1117
    calu on #43287

    Hello Ravi, thank you very much for the code, it’s working perfectly. I think this adds something to the UE, as the user do not have to exit edit after update. But that is a matter of opinion.

    Thanks again Ravi for bringing up a solution so fast, I really appreciate it.

    Regards
    Carsten

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on #43447

    Hello Carsten,

    Thank you for the acknowledgment. I am glad that I could help you.

    Regards
    Ravi

The topic ‘ [Resolved] Directed back to profile after edit’ is closed to new replies.

This topic is: resolved