Drupal - Redirect User to their Profile Page After Saving

As @Aboodred, if you already have the Rules module installed, adding a simple rule can do the job.

  1. Create a rule with the React on event type After updating an existing user account.

  2. Add a Page redirect action. Set the 'Data selector' field to account:url (either manually or using the dropdown).

enter image description here


If you want to do it with code instead of rules you can take a look at how the user_edit_cancel_submit function does it in user.pages.inc.

First you define an submit function: $form['#submit'][] = 'custom_redirect_after_save';

Then you add the function:

function custom_redirect_after_save($form, &$form_state) {
  if (isset($_GET['destination'])) {
    unset($_GET['destination']);
  }
  $form_state['redirect'] = array("user", array());
}

Tags:

Nodes

Users