我在drupal 6中创建了一个重置密码表单。在提交时我必须重定向到显示Drupal消息的同一页面。
我写了以下内容:
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;
}
但我的邮件代码工作正常但我的邮件没有显示。
答案 0 :(得分:2)
尝试使用此代码,它会将您重定向到同一页面并显示消息...
$msg = "Further instructions have been sent to your e-mail address.";
drupal_set_message($msg, $type = 'status');
drupal_goto('user/password');
答案 1 :(得分:1)
$form_state
是通过引用传递的?答案 2 :(得分:1)
您可以尝试使用此代码重定向到带有消息
的其他页面drupal_set_message(t('Further instructions have been sent to your e-mail address.'));
drupal_goto('user/password');
答案 3 :(得分:1)
而不是$form_state['redirect']
使用drupal_goto
函数:
drupal_set_message(
'Further instructions have been sent to your e-mail address.',
'status', $repeat = FALSE);
drupal_goto('user/password');