我在Drupal6中创建了一个重置密码表单。提交时,我必须重定向到显示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;
}但是我的邮件代码工作正常,但是我的消息没有显示。
发布于 2015-05-07 18:12:22
尝试此代码,它会将您重定向到同一页面并显示消息...
$msg = "Further instructions have been sent to your e-mail address.";
drupal_set_message($msg, $type = 'status');
drupal_goto('user/password');发布于 2013-04-10 22:51:00
$form_state是通过引用传入的--发布于 2015-04-14 16:43:07
您可以尝试使用此代码重定向到另一个带有消息的页面
drupal_set_message(t('Further instructions have been sent to your e-mail address.'));
drupal_goto('user/password');https://stackoverflow.com/questions/15810533
复制相似问题