You are here

function oa_core_form_user_profile_form_alter in Open Atrium Core 7.2

Implements hook_form_FORM_ID_alter() for user_profile_form.

File

includes/oa_core.login.inc, line 11
Code for controlling redirection of login Some of this code comes from the login_destination module

Code

function oa_core_form_user_profile_form_alter(&$form, &$form_state, $form_id) {

  // We redirect by using the drupal_goto_alter hook. If we simply
  // call drupal_goto() it may break compability with other modules. If we set
  // the $_GET['destination'] variable we will loose the possibility to redirect
  // to an external URL.
  // Please note the the system_goto_action() calls drupal_goto()
  // More on this issue http://drupal.org/node/732542.
  // If we add the $form_state['redirect'] here it will be overriden by the
  // user_login_submit(). So we add a submit handler instead and will set the
  // redirect later. Our submit handler will be executed after the execution
  // of user_login_submit(). This is because form_submit() functions are
  // appended to form before hook_form_alter() is executed.
  if (isset($_GET['pass-reset-token'])) {

    // Redirect only from user_pass_reset
    // You have to explicitally turn on the option to always redirect from
    // the profile page. This is for constistency.
    $form['#submit'][] = 'oa_core_login_submit';
  }
}