function drupal_set_message

You are here

7 drupal_set_message($message = NULL, $type = 'status', $repeat = TRUE)
4.6 drupal_set_message($message = NULL, $type = 'status')
4.7 drupal_set_message($message = NULL, $type = 'status')
5 drupal_set_message($message = NULL, $type = 'status')
6 drupal_set_message($message = NULL, $type = 'status', $repeat = TRUE)
8 drupal_set_message($message = NULL, $type = 'status', $repeat = FALSE)

Set a message which reflects the status of the performed operation.

If the function is called with no arguments, this function returns all set messages without clearing them.


$message: The message should begin with a capital letter and always ends with a period '.'.

$type: The type of the message. One of the following values are possible:

  • 'status'
  • 'error'
106 calls to drupal_set_message()
aggregator_form_category_submit in modules/aggregator.module
Process aggregator_form_category form submissions. @todo Add delete confirmation dialog.
aggregator_form_feed_submit in modules/aggregator.module
Process aggregator_form_feed form submissions. @todo Add delete confirmation dialog.
aggregator_page_list_submit in modules/aggregator.module
aggregator_parse_feed in modules/aggregator.module
aggregator_refresh in modules/aggregator.module
Checks a news feed for new items.

... See full list


includes/, line 722
Functions that need to be loaded on every Drupal request.


function drupal_set_message($message = NULL, $type = 'status') {
  if ($message) {
    if (!isset($_SESSION['messages'])) {
      $_SESSION['messages'] = array();

    if (!isset($_SESSION['messages'][$type])) {
      $_SESSION['messages'][$type] = array();

    $_SESSION['messages'][$type][] = $message;

  // messages not set when DB connection fails
  return isset($_SESSION['messages']) ? $_SESSION['messages'] : NULL;