- Modified patch #7958 by Adrian: store status messages in a session so they can persist when redirection is used.

4.5.x
Dries Buytaert 2004-05-22 22:21:49 +00:00
parent d09023164e
commit 2e67c2ffa1
1 changed files with 11 additions and 6 deletions

View File

@ -40,17 +40,22 @@ function drupal_get_title() {
* @{
*/
function drupal_set_message($message = NULL, $type = "status") {
static $stored_message = array();
if (isset($message)) {
$stored_message[] = array($message, $type);
if (!isset($_SESSION['messages'])) {
$_SESSION['messages'] = array();
}
return $stored_message;
if (isset($message)) {
$_SESSION['messages'][] = array($message, $type);
}
return $_SESSION['messages'];
}
function drupal_get_messages() {
return drupal_set_message();
$messages = drupal_set_message();
$_SESSION['messages'] = array();
return $messages;
}
/* @} */