How do I make it so that after a user submits the user_edit form, updating their info, they are brought back to the edit form? For instance, user 2 is at "?q=user/2/edit", after they post, form action="?q=user/2/edit", they end up back at "?q=user/2/edit" and not "?q=user/2". I've tried "drupal_redirect_form($form, $redirect = 'user/2/edit');", but all this does is set a redirecting perpetual loop.

Sean

Comments

couloir007’s picture

Basically, how do I make "$form_state['redirect'] = 'user/'. $account->uid;" below read "$form_state['redirect'] = 'user/'. $account->uid;.'/edit'" without editing the user module? If I can't, is it bad practice to edit the module? Can I override the module function?

function user_edit_submit($form_values, $form, &$form_state) {
  $account = $form_values['_account'];
  $category = $form_values['_category'];
  unset($form_values['_account'], $form_values['op'], $form_values['submit'], $form_values['delete'], $form_values['form_token'], $form_values['form_id'], $form_values['_category']);
  user_module_invoke('submit', $form_values, $account, $category);
  user_save($account, $form_values, $category);

  // Clear the page cache because pages can contain usernames and/or profile information:
  cache_clear_all();

  drupal_set_message(t('The changes have been saved.'));
  $form_state['redirect'] = 'user/'. $account->uid;
  return;
}
couloir007’s picture

Found the answer at http://www.ventanazul.com/webzine/articles/redirect-user-after-submit-fo.... In a custom module:

	function mymodule_form_alter($form_id, &$form){
		if ($form_id == 'user_edit'){
			$form['#redirect'] = 'user/$uid/edit';
		}
	}

Note:
Finding answers to simple questions in Drupal is like pulling teeth.