5

The solution shown in How can I redirect users upon login sometimes but not break the "Forgot password?" function? work for Drupal 7.

In Drupal 6, with the User:user has logged in event and the following PHP conditions, nothing happens.

if (arg(0) == 'user' && arg(1) == 'reset') { 
  return false; 
} else { 
  return true; 
}

How can I redirect users upon password reset in Drupal 6?

PS. The only variable for this event is $account for the logged-in user.

This is the exported rule I am using.

array (
  'rules' => 
  array (
    'rules_passwordreset' => 
    array (
      '#type' => 'rule',
      '#set' => 'event_user_login',
      '#label' => 'passwordreset',
      '#active' => 1,
      '#weight' => '0',
      '#categories' => 
      array (
      ),
      '#status' => 'custom',
      '#conditions' => 
      array (
        0 => 
        array (
          '#weight' => 0,
          '#type' => 'condition',
          '#settings' => 
          array (
            'code' => 'if (arg(0) == \'user\' && arg(1) == \'reset\') { 
  return false; 
} else { 
  return true; 
}',
            'vars' => 
            array (
            ),
          ),
          '#name' => 'rules_condition_custom_php',
          '#info' => 
          array (
            'label' => 'Execute custom PHP code',
            'module' => 'PHP',
            'eval input' => 
            array (
              0 => 'code',
            ),
          ),
        ),
      ),
      '#actions' => 
      array (
        0 => 
        array (
          '#weight' => 0,
          '#info' => 
          array (
            'label' => 'Page redirect',
            'module' => 'System',
            'eval input' => 
            array (
              0 => 'path',
              1 => 'query',
              2 => 'fragment',
            ),
          ),
          '#name' => 'rules_action_drupal_goto',
          '#settings' => 
          array (
            'path' => 'http://www.sample.com',
            'query' => '',
            'fragment' => '',
            'force' => 0,
            'immediate' => 0,
          ),
          '#type' => 'action',
        ),
      ),
      '#version' => 6003,
    ),
  ),
)
1

You can define submit function in your password form_alter and then $form_state['redirect'] = 'user'; or 'user/register'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.