2013-04-04 46 views
2

我已經創建在Drupal 6重置密碼錶單提出我要重定向到同一頁面展示一個Drupal消息。drupal_set_message 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

我認爲[這是答案] [1]你正在尋找。 [1]:http://stackoverflow.com/questions/1513289/drupal-drupal-set-message-doesnt-display-a-message?rq=1 – nit3ch 2013-04-04 20:26:20

回答

1
  • 您是否嘗試切換回Garland(檢查主題是否有錯)?
  • 你是否檢查過你的用戶表有一個匿名的0(零)條目?由於uid字段上的自動增量設置,導入的表有時會丟失該行。
  • 該消息是否顯示已驗證/管理員用戶?
  • 我假設你的片段是提交處理程序?我認爲$form_state被引用傳入?
1

你可以試試這個代碼重定向到另一個頁面,消息

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

試試這個代碼會重定向你相同的網頁,並顯示消息對...

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