2

I have created a reset password form in drupal 6. On submit I have to redirect to the same page show a Drupal message.

I have written the following:

  global $language;

  $account = $form_state['values']['account'];

  _user_mail_notify('password_reset', $account, $language);


  watchdog('user', 'Password reset instructions mailed to %name at %email.', array('%name' => $account->name, '%email' => $account->mail));

  drupal_set_message(t('Further instructions have been sent to your e-mail address.'));

  $form_state['redirect'] = 'user/password';
  return;

}

but my mail code is working fine but my message is not shown.

1

4 Answers 4

2

Try this code it will redirect you on same page and show message...

$msg = "Further instructions have been sent to your e-mail address.";
drupal_set_message($msg, $type = 'status');
drupal_goto('user/password');
Sign up to request clarification or add additional context in comments.

Comments

1
  • Have you tried switching back to Garland (to check if the theme is at fault)?
  • Have you checked your user table has a 0 (zero) entry for anonymous? Sometimes imported tables miss that row due to the auto increment setting on the uid field.
  • Does the message show for authenticated/admin users?
  • I assume your snippet is the submit handler? I assume $form_state is being passed in by reference?

Comments

1

You can try this code to redirect to another page with message

drupal_set_message(t('Further instructions have been sent to your e-mail address.'));
drupal_goto('user/password');

Comments

1

Instead of $form_state['redirect'] use the drupal_goto function:

drupal_set_message(
    'Further instructions have been sent to your e-mail address.',
     'status', $repeat = FALSE);
drupal_goto('user/password');

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.