drupal\u设置\u消息drupal

drupal\u设置\u消息drupal,drupal,Drupal,我在Drupal6中创建了一个重置密码表单。在提交时,我必须重定向到同一页面,显示Drupal消息 我写了以下内容: global $language; $account = $form_state['values']['account']; _user_mail_notify('password_reset', $account, $language); watchdog('user', 'Password reset instructions mailed to %n

我在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;

}
但是我的邮件代码工作正常,但我的邮件没有显示。

  • 你是否试过切换回Garland(检查主题是否有问题)
  • 您是否已检查您的用户表中是否有0(零)个匿名项?有时,由于uid字段上的自动递增设置,导入的表会丢失该行
  • 该消息是否针对已验证/管理员用户显示
  • 我假设您的代码片段是提交处理程序?我假设
    $form\u state
    是通过引用传入的

您可以尝试使用此代码重定向到另一个包含消息的页面

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

试试这段代码,它会在同一页上重定向你并显示消息

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

不要使用
$form\u state['redirect']
使用
drupal\u goto
函数:

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

我认为[这是答案][1]你在寻找。[1]: