Community Documentation

drupal_set_message

5 bootstrap.inc drupal_set_message($message = NULL, $type = 'status')
6 bootstrap.inc drupal_set_message($message = NULL, $type = 'status', $repeat = TRUE)
7 bootstrap.inc drupal_set_message($message = NULL, $type = 'status', $repeat = TRUE)
8 bootstrap.inc drupal_set_message($message = NULL, $type = 'status', $repeat = TRUE)

Sets 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.

Parameters

$message: The message to be displayed to the user. For consistency with other messages, it should begin with a capital letter and end with a period.

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

  • 'status'
  • 'warning'
  • 'error'

$repeat: If this is FALSE and the message is already set, then the message won't be repeated.

▾ 259 functions call drupal_set_message()

aggregator_aggregator_fetch in modules/aggregator/aggregator.fetcher.inc
Implements hook_aggregator_fetch().
aggregator_aggregator_remove in modules/aggregator/aggregator.processor.inc
Implements hook_aggregator_remove().
aggregator_categorize_items_submit in modules/aggregator/aggregator.pages.inc
Form submission handler for aggregator_categorize_items().
aggregator_form_category_submit in modules/aggregator/aggregator.admin.inc
Form submission handler for aggregator_form_category().
aggregator_form_feed_submit in modules/aggregator/aggregator.admin.inc
Form submission handler for aggregator_form_feed().
aggregator_form_opml_submit in modules/aggregator/aggregator.admin.inc
Form submission handler for aggregator_form_opml().
aggregator_parse_feed in modules/aggregator/aggregator.parser.inc
Parses a feed and stores its items.
aggregator_refresh in modules/aggregator/aggregator.module
Checks a news feed for new items.
ajax_forms_test_validation_form_callback in modules/simpletest/tests/ajax_forms_test.module
Ajax callback for the 'drivertext' element of the validation form.
ajax_forms_test_validation_form_submit in modules/simpletest/tests/ajax_forms_test.module
Submit handler for the validation form.
authorize_filetransfer_form in includes/authorize.inc
Form constructor for the file transfer authorization form.
block_add_block_form_submit in modules/block/block.admin.inc
Form submission handler for block_add_block_form().
block_admin_configure_submit in modules/block/block.admin.inc
Form submission handler for block_admin_configure().
block_admin_display_form_submit in modules/block/block.admin.inc
Form submission handler for block_admin_display_form().
block_custom_block_delete_submit in modules/block/block.admin.inc
Form submission handler for block_custom_block_delete().
block_form_form_test_alter_form_alter in modules/simpletest/tests/form_test.module
Implements hook_form_FORM_ID_alter() on behalf of block.module.
block_update_7004 in modules/block/block.install
Add new blocks to new regions, migrate custom variables to blocks.
blog_page_last in modules/blog/blog.pages.inc
Menu callback; displays a Drupal page containing recent blog entries of all users.
blog_page_user in modules/blog/blog.pages.inc
Menu callback; displays a Drupal page containing recent blog entries of a given user.
book_admin_edit_submit in modules/book/book.admin.inc
Handle submission of the book administrative page form.
book_export in modules/book/book.pages.inc
Menu callback; Generates various representation of a book page and its children.
book_outline_form_submit in modules/book/book.pages.inc
Handles book outline form submissions from the outline tab.
book_remove_form_submit in modules/book/book.pages.inc
Confirm form submit function to remove a node from the book.
color_scheme_form_submit in modules/color/color.module
Form submission handler for color_scheme_form().
color_update_7001 in modules/color/color.install
Warn site administrator if unsafe CSS color codes are found in the database.
comment_admin_overview_submit in modules/comment/comment.admin.inc
Process comment_admin_overview form submissions.
comment_approve in modules/comment/comment.pages.inc
Menu callback; publish specified comment.
comment_confirm_delete_submit in modules/comment/comment.admin.inc
Process comment_confirm_delete form submissions.
comment_form_submit in modules/comment/comment.module
Process comment form submissions; prepare the comment, store it, and set a redirection target.
comment_multiple_delete_confirm in modules/comment/comment.admin.inc
List the selected comments and verify that the admin wants to delete them.
comment_multiple_delete_confirm_submit in modules/comment/comment.admin.inc
Process comment_multiple_delete_confirm form submissions.
comment_reply in modules/comment/comment.pages.inc
This function is responsible for generating a comment reply form. There are several cases that have to be handled, including:
contact_category_delete_form_submit in modules/contact/contact.admin.inc
Form submission handler for contact_category_delete_form().
contact_category_edit_form_submit in modules/contact/contact.admin.inc
Form submission handler for contact_category_edit_form().
contact_personal_form in modules/contact/contact.pages.inc
Form constructor for the personal contact form.
contact_personal_form_submit in modules/contact/contact.pages.inc
Form submission handler for contact_personal_form().
contact_site_form in modules/contact/contact.pages.inc
Form constructor for the site-wide contact form.
contact_site_form_submit in modules/contact/contact.pages.inc
Form submission handler for contact_site_form().
dashboard_update in modules/dashboard/dashboard.module
Set the new weight of each region according to the drag-and-drop order.
dblog_clear_log_submit in modules/dblog/dblog.admin.inc
Submit callback: clear database with log messages.
drupal_check_module in includes/install.inc
Check a module's requirements.
drupal_get_messages in includes/bootstrap.inc
Returns all messages that have been set.
drupal_mail in includes/mail.inc
Compose and optionally send an e-mail message.
field_test_entity_form_submit in modules/field/tests/field_test.entity.inc
Submit handler for field_test_entity_form().
field_test_entity_nested_form_submit in modules/field/tests/field_test.entity.inc
Submit handler for field_test_entity_nested_form().
field_test_field_widget_form_alter in modules/field/tests/field_test.module
Implements hook_field_widget_form_alter().
field_ui_display_overview_form in modules/field_ui/field_ui.admin.inc
Form constructor for the field display settings for a given view mode.
field_ui_display_overview_form_submit in modules/field_ui/field_ui.admin.inc
Form submission handler for field_ui_display_overview_form().
field_ui_field_delete_form_submit in modules/field_ui/field_ui.admin.inc
Form submission handler for field_ui_field_delete_form().
field_ui_field_edit_form_submit in modules/field_ui/field_ui.admin.inc
Form submission handler for field_ui_field_edit_form().
field_ui_field_overview_form_submit in modules/field_ui/field_ui.admin.inc
Form submission handler for field_ui_field_overview_form().
field_ui_field_settings_form_submit in modules/field_ui/field_ui.admin.inc
Form submission handler for field_ui_field_settings_form().
field_ui_inactive_message in modules/field_ui/field_ui.admin.inc
Displays a message listing the inactive fields of a given bundle.
field_ui_widget_type_form_submit in modules/field_ui/field_ui.admin.inc
Form submission handler for field_ui_widget_type_form().
file_ajax_upload in modules/file/file.module
Menu callback; Shared Ajax callback for file uploads and deletions.
file_copy in includes/file.inc
Copies a file to a new location and adds a file record to the database.
file_delete in includes/file.inc
Delete a file and its database record.
file_module_test_form_submit in modules/file/tests/file_module_test.module
Form submission handler for file_module_test_form().
file_move in includes/file.inc
Move a file to a new location and update the file's database entry.
file_munge_filename in includes/file.inc
Modify a filename as needed for security purposes.
file_save_data in includes/file.inc
Save a string to the specified destination and create a database file entry.
file_save_upload in includes/file.inc
Saves a file upload to a new location.
file_unmanaged_copy in includes/file.inc
Copies a file to a new location without invoking the file API.
file_unmanaged_save_data in includes/file.inc
Save a string to the specified destination without invoking file API.
file_validate_image_resolution in includes/file.inc
Verify that image dimensions are within the specified maximum and minimum.
filter_admin_disable_submit in modules/filter/filter.admin.inc
Process filter disable form submission.
filter_admin_format_form_submit in modules/filter/filter.admin.inc
Process text format form submissions.
filter_admin_overview_submit in modules/filter/filter.admin.inc
filter_test_filter_format_disable in modules/simpletest/tests/filter_test.module
Implements hook_filter_format_disable().
filter_test_filter_format_insert in modules/simpletest/tests/filter_test.module
Implements hook_filter_format_insert().
filter_test_filter_format_update in modules/simpletest/tests/filter_test.module
Implements hook_filter_format_update().
filter_update_7005 in modules/filter/filter.install
Integrate text formats with the user permissions system.
form_set_error in includes/form.inc
Files an error against a form element.
form_test_clicked_button_submit in modules/simpletest/tests/form_test.module
Form submit handler for the form_test_clicked_button() form.
form_test_clicked_button_validate in modules/simpletest/tests/form_test.module
Form validation handler for the form_test_clicked_button() form.
form_test_element_validate_name in modules/simpletest/tests/form_test.module
Form element validation handler for 'name' in form_test_validate_form().
form_test_form_alter in modules/simpletest/tests/form_test.module
Implements hook_form_alter().
form_test_form_form_test_alter_form_alter in modules/simpletest/tests/form_test.module
Implements hook_form_FORM_ID_alter().
form_test_form_rebuild_preserve_values_form_submit in modules/simpletest/tests/form_test.module
Form submit handler for form_test_form_rebuild_preserve_values_form().
form_test_limit_validation_errors_form_partial_submit in modules/simpletest/tests/form_test.module
Form submit handler for the partial validation submit button.
form_test_load_include_submit in modules/simpletest/tests/form_test.file.inc
Submit callback for the form API file inclusion test forms.
form_test_state_persist_submit in modules/simpletest/tests/form_test.module
Submit handler.
form_test_storage_form in modules/simpletest/tests/form_test.module
A multistep form for testing the form storage.
form_test_storage_form_submit in modules/simpletest/tests/form_test.module
Form submit handler to finish multi-step form.
form_test_user_register_form_rebuild in modules/simpletest/tests/form_test.module
Submit callback that just lets the form rebuild.
form_test_validate_form_validate in modules/simpletest/tests/form_test.module
Form validation handler for form_test_validate_form().
forum_confirm_delete_submit in modules/forum/forum.admin.inc
Implement forms api _submit call. Deletes a forum after confirmation.
forum_form_submit in modules/forum/forum.admin.inc
Process forum form and container form submissions.
hook_comment_delete in modules/comment/comment.api.php
The comment is being deleted by the moderator.
hook_comment_publish in modules/comment/comment.api.php
The comment is being published by the moderator.
hook_comment_unpublish in modules/comment/comment.api.php
The comment is being unpublished by the moderator.
hook_modules_enabled in modules/system/system.api.php
Perform necessary actions after modules are enabled.
hook_node_type_insert in modules/node/node.api.php
Respond to node type creation.
hook_user_login in modules/user/user.api.php
The user just logged in.
image_effect_delete_form_submit in modules/image/image.admin.inc
Submit handler to delete an image effect.
image_effect_form_submit in modules/image/image.admin.inc
Submit handler for updating an image effect.
image_style_add_form_submit in modules/image/image.admin.inc
Submit handler for adding a new image style.
image_style_delete_form_submit in modules/image/image.admin.inc
Submit handler to delete an image style.
image_style_form in modules/image/image.admin.inc
Form builder; Edit an image style name and effects order.
image_style_form_add_submit in modules/image/image.admin.inc
Submit handler for adding a new image effect to an image style.
image_style_form_override_submit in modules/image/image.admin.inc
Submit handler for overriding a module-defined style.
image_style_form_submit in modules/image/image.admin.inc
Submit handler for saving an image style.
image_style_revert_form_submit in modules/image/image.admin.inc
Submit handler to convert an overridden style to its default.
install_configure_form in includes/install.core.inc
Installation task; configure settings for the new site.
install_finished in includes/install.core.inc
Installation task; perform final steps and display a 'finished' page.
locale_date_format_form_submit in modules/locale/locale.admin.inc
Submit handler for configuring localized date formats on the locale_date_format_form.
locale_languages_configure_form_submit in modules/locale/locale.admin.inc
Submit handler for language negotiation settings.
locale_languages_delete_form in modules/locale/locale.admin.inc
User interface for the language deletion confirmation screen.
locale_languages_delete_form_submit in modules/locale/locale.admin.inc
Process language deletion submissions.
locale_languages_overview_form_submit in modules/locale/locale.admin.inc
Process language overview form submissions, updating existing languages.
locale_languages_predefined_form_submit in modules/locale/locale.admin.inc
Process the language addition form submission.
locale_translate_delete_form_submit in modules/locale/locale.admin.inc
Process string deletion submissions.
locale_translate_edit_form in modules/locale/locale.admin.inc
User interface for string editing.
locale_translate_edit_form_submit in modules/locale/locale.admin.inc
Process string editing form submissions.
locale_translate_import_form_submit in modules/locale/locale.admin.inc
Process the locale import form submission.
menu_delete_menu_confirm_submit in modules/menu/menu.admin.inc
Delete a custom menu and all links in it.
menu_edit_item_submit in modules/menu/menu.admin.inc
Process menu and menu item add/edit form submissions.
menu_edit_item_validate in modules/menu/menu.admin.inc
Validate form values for a menu link being added or edited.
menu_edit_menu_submit in modules/menu/menu.admin.inc
Submit function for adding or editing a custom menu.
menu_item_delete_form_submit in modules/menu/menu.admin.inc
Process menu delete form submissions.
menu_node_save in modules/menu/menu.module
Helper for hook_node_insert() and hook_node_update().
menu_overview_form_submit in modules/menu/menu.admin.inc
Submit handler for the menu overview form.
menu_reset_item_confirm_submit in modules/menu/menu.admin.inc
Process menu reset item form submissions.
node_access_rebuild in modules/node/node.module
Rebuild the node access database. This is occasionally needed by modules that make system-wide changes to access levels.
node_delete_confirm_submit in modules/node/node.pages.inc
Execute node deletion
node_form_submit in modules/node/node.pages.inc
node_help in modules/node/node.module
Implements hook_help().
node_mass_update in modules/node/node.admin.inc
Make mass update of nodes, changing all nodes in the $nodes array to update them with the field values in $updates.
node_multiple_delete_confirm_submit in modules/node/node.admin.inc
node_node_type_insert in modules/node/content_types.inc
Implements hook_node_type_insert().
node_node_type_update in modules/node/content_types.inc
Implements hook_node_type_update().
node_revision_delete_confirm_submit in modules/node/node.pages.inc
node_revision_revert_confirm_submit in modules/node/node.pages.inc
node_type_delete_confirm_submit in modules/node/content_types.inc
Process content type delete confirm submissions.
node_type_form_submit in modules/node/content_types.inc
Form submission handler for node_type_form().
openid_authentication in modules/openid/openid.module
Authenticate a user or attempt registration.
openid_authentication_page in modules/openid/openid.pages.inc
Menu callback; Process an OpenID authentication.
openid_user_delete_form_submit in modules/openid/openid.pages.inc
openid_user_identities in modules/openid/openid.pages.inc
Menu callback; Manage OpenID identities for the specified user.
openid_user_insert in modules/openid/openid.module
Implements hook_user_insert().
overlay_user_dismiss_message in modules/overlay/overlay.module
Menu callback; dismisses the overlay accessibility message for this user.
path_admin_form_submit in modules/path/path.admin.inc
Save a URL alias to the database.
php_disable in modules/php/php.install
Implements hook_disable().
php_enable in modules/php/php.install
Implements hook_enable().
poll_cancel in modules/poll/poll.module
Submit callback for poll_cancel_form().
poll_vote in modules/poll/poll.module
Submit handler for processing a vote.
profile_admin_overview_submit in modules/profile/profile.admin.inc
Submit handler to update changed profile field weights and categories.
profile_field_delete_submit in modules/profile/profile.admin.inc
Process a field delete form submission.
profile_field_form_submit in modules/profile/profile.admin.inc
Process profile_field_form submissions.
SearchQuery::executeFirstPass in modules/search/search.extender.inc
Executes the first pass query.
SearchQuery::parseSearchExpression in modules/search/search.extender.inc
Parses the search query into SQL conditions.
search_admin_settings_submit in modules/search/search.admin.inc
Form submission handler for search_admin_settings().
search_embedded_form_form_submit in modules/search/tests/search_embedded_form.module
Submit handler for search_embedded_form_form().
search_reindex_confirm_submit in modules/search/search.admin.inc
Handler for wipe confirmation
shortcut_link_add_inline in modules/shortcut/shortcut.admin.inc
Menu page callback: creates a new link in the provided shortcut set.
shortcut_link_add_submit in modules/shortcut/shortcut.admin.inc
Submit handler for shortcut_link_add().
shortcut_link_delete_submit in modules/shortcut/shortcut.admin.inc
Submit handler for shortcut_link_delete_submit().
shortcut_link_edit_submit in modules/shortcut/shortcut.admin.inc
Submit handler for shortcut_link_edit().
shortcut_set_add_form_submit in modules/shortcut/shortcut.admin.inc
Submit handler for shortcut_set_add_form().
shortcut_set_customize_submit in modules/shortcut/shortcut.admin.inc
Submit handler for shortcut_set_customize().
shortcut_set_delete_form_submit in modules/shortcut/shortcut.admin.inc
Submit handler for shortcut_set_delete_form().
shortcut_set_edit_form_submit in modules/shortcut/shortcut.admin.inc
Submit handler for shortcut_set_edit_form().
shortcut_set_switch_submit in modules/shortcut/shortcut.admin.inc
Submit handler for shortcut_set_switch().
simpletest_clean_database in modules/simpletest/simpletest.module
Removed prefixed tables from the database that are left over from crashed tests.
simpletest_clean_environment in modules/simpletest/simpletest.module
Remove all temporary database tables and directories.
simpletest_clean_temporary_directories in modules/simpletest/simpletest.module
Find all leftover temporary directories and remove them.
simpletest_result_form in modules/simpletest/simpletest.pages.inc
Test results form for $test_id.
simpletest_test_form_submit in modules/simpletest/simpletest.pages.inc
Run selected tests.
system_actions_configure_submit in modules/system/system.admin.inc
Process system_actions_configure() form submissions.
system_actions_delete_form_submit in modules/system/system.admin.inc
Process system_actions_delete form submissions.
system_action_delete_orphans_post in modules/system/system.admin.inc
Post-deletion operations for deleting action orphans.
system_add_date_formats_form_submit in modules/system/system.admin.inc
Process new date format string submission.
system_add_date_format_type_form_submit in modules/system/system.admin.inc
Process system_add_date_format_type form submissions.
system_admin_config_page in modules/system/system.admin.inc
Menu callback; Provide the administration overview page.
system_clean_url_settings in modules/system/system.admin.inc
Form builder; Configure clean URL settings.
system_clear_cache_submit in modules/system/system.admin.inc
Submit callback; clear system caches.
system_date_delete_format_form_submit in modules/system/system.admin.inc
Delete a configured date format.
system_delete_date_format_type_form_submit in modules/system/system.admin.inc
Delete a configured date type.
system_form_form_test_alter_form_alter in modules/simpletest/tests/form_test.module
Implements hook_form_FORM_ID_alter() on behalf of system.module.
system_ip_blocking_delete_submit in modules/system/system.admin.inc
Process system_ip_blocking_delete form submissions.
system_ip_blocking_form_submit in modules/system/system.admin.inc
system_message_action in modules/system/system.module
Sends a message to the current user's screen.
system_modules_submit in modules/system/system.admin.inc
Submit callback; handles modules form submission.
system_modules_uninstall_submit in modules/system/system.admin.inc
Processes the submitted uninstall form.
system_modules_uninstall_validate in modules/system/system.admin.inc
Validates the submitted uninstall form.
system_retrieve_file in modules/system/system.module
Attempts to get a file using drupal_http_request and to store it locally.
system_run_cron in modules/system/system.admin.inc
Menu callback: run cron manually.
system_run_cron_submit in modules/system/system.admin.inc
Submit callback; run cron.
system_settings_form in modules/system/system.module
Add default buttons to a form and set its prefix.
system_settings_form_submit in modules/system/system.module
Execute the system_settings_form.
system_test_init in modules/simpletest/tests/system_test.module
Implements hook_init().
system_test_modules_disabled in modules/simpletest/tests/system_test.module
Implements hook_modules_disabled().
system_test_modules_enabled in modules/simpletest/tests/system_test.module
Implements hook_modules_enabled().
system_test_modules_installed in modules/simpletest/tests/system_test.module
Implements hook_modules_installed().
system_test_modules_uninstalled in modules/simpletest/tests/system_test.module
Implements hook_modules_uninstalled().
system_themes_admin_form_submit in modules/system/system.admin.inc
Process system_themes_admin_form form submissions.
system_theme_default in modules/system/system.admin.inc
Menu callback; Set the default theme.
system_theme_disable in modules/system/system.admin.inc
Menu callback; Disables a theme.
system_theme_enable in modules/system/system.admin.inc
Menu callback; Enables a theme.
system_theme_settings_submit in modules/system/system.admin.inc
Process system_theme_settings form submissions.
system_update_7003 in modules/system/system.install
Update {blocked_ips} with valid IP addresses from {access}.
system_update_7013 in modules/system/system.install
Convert default time zone offset to default time zone name.
system_update_7060 in modules/system/system.install
Create fields in preparation for migrating upload.module to file.module.
system_update_7067 in modules/system/system.install
Grant administrators permission to view the administration theme.
system_user_login in modules/system/system.module
Implements hook_user_login().
taxonomy_form_term_submit in modules/taxonomy/taxonomy.admin.inc
Submit handler to insert or update a term.
taxonomy_form_vocabulary_submit in modules/taxonomy/taxonomy.admin.inc
Form submission handler for taxonomy_form_vocabulary().
taxonomy_overview_terms_submit in modules/taxonomy/taxonomy.admin.inc
Submit handler for terms overview form.
taxonomy_overview_vocabularies_submit in modules/taxonomy/taxonomy.admin.inc
Submit handler for vocabularies overview. Updates changed vocabulary weights.
taxonomy_term_confirm_delete_submit in modules/taxonomy/taxonomy.admin.inc
Submit handler to delete a term after confirmation.
taxonomy_vocabulary_confirm_delete_submit in modules/taxonomy/taxonomy.admin.inc
Submit handler to delete a vocabulary after confirmation.
taxonomy_vocabulary_confirm_reset_alphabetical_submit in modules/taxonomy/taxonomy.admin.inc
Submit handler to reset a vocabulary to alphabetical order after confirmation.
theme_node_preview in modules/node/node.pages.inc
Returns HTML for a node preview for display during node creation and editing.
translation_node_prepare in modules/translation/translation.module
Implements hook_node_prepare().
trigger_assign_form_submit in modules/trigger/trigger.admin.inc
Submit function for trigger_assign_form().
trigger_unassign_submit in modules/trigger/trigger.admin.inc
Submit callback for trigger_unassign() form.
update_fetch_data_finished in modules/update/update.fetch.inc
Batch API callback when all fetch tasks have been completed.
update_init in modules/update/update.module
Implements hook_init().
update_manager_download_batch_finished in modules/update/update.manager.inc
Batch callback invoked when the download batch is completed.
update_manager_install_form_submit in modules/update/update.manager.inc
Handle form submission when installing new projects via the update manager.
update_script_selection_form in ./update.php
update_script_test_flush_caches in modules/simpletest/tests/update_script_test.module
Implements hook_flush_caches().
url_alter_test_url_inbound_alter in modules/simpletest/tests/url_alter_test.module
Implements hook_url_inbound_alter().
user_admin_account_submit in modules/user/user.admin.inc
Submit the user administration update form.
user_admin_permissions_submit in modules/user/user.admin.inc
Save permissions selected on the administer permissions page.
user_admin_roles_order_submit in modules/user/user.admin.inc
Form submit function. Update the role weights.
user_admin_role_delete_confirm_submit in modules/user/user.admin.inc
Form submit handler for user_admin_role_delete_confirm().
user_admin_role_submit in modules/user/user.admin.inc
Form submit handler for the user_admin_role() form.
user_cancel in modules/user/user.module
Cancel a user account.
user_cancel_confirm in modules/user/user.pages.inc
Menu callback; Cancel a user account via e-mail confirmation link.
user_cancel_confirm_form_submit in modules/user/user.pages.inc
Submit handler for the account cancellation confirm form.
user_external_login_register in modules/user/user.module
Helper function for authentication modules. Either logs in or registers the current user, based on username. Either way, the global $user object is populated and login tasks are performed.
user_form_test_current_password_submit in modules/user/tests/user_form_test.module
Submit function for the test form for user_validate_current_pass().
user_multiple_cancel_confirm in modules/user/user.module
user_pass_reset in modules/user/user.pages.inc
Menu callback; process one time login link and redirects to the user page on success.
user_pass_submit in modules/user/user.pages.inc
user_profile_form_submit in modules/user/user.pages.inc
Submit function for the user account and profile editing form.
user_register_submit in modules/user/user.module
Submit handler for the user registration form.
user_update_7002 in modules/user/user.install
Convert user time zones from time zone offsets to time zone names.
_batch_do in includes/batch.inc
Does one execution pass with JavaScript and returns progress to the browser.
_batch_page in includes/batch.inc
Renders the batch processing page based on the current state of the batch.
_batch_test_finished_helper in modules/simpletest/tests/batch_test.callbacks.inc
Common 'finished' callbacks for batches 1 to 4.
_block_rehash in modules/block/block.module
Updates the 'block' DB table with the blocks currently exported by modules.
_drupal_log_error in includes/errors.inc
Log a PHP error or exception, display an error page in fatal cases.
_file_test_form_submit in modules/simpletest/tests/file_test.module
Process the upload.
_form_test_tableselect_multiple_false_form_submit in modules/simpletest/tests/form_test.module
Process the tableselect #multiple = FALSE submitted values.
_form_test_tableselect_multiple_true_form_submit in modules/simpletest/tests/form_test.module
Process the tableselect #multiple = TRUE submitted values.
_locale_batch_language_finished in includes/locale.inc
Finished callback of language addition locale import batch. Inform the user of translation files imported.
_locale_batch_system_finished in includes/locale.inc
Finished callback of system page locale import batch. Inform the user of translation files imported.
_locale_import_message in includes/locale.inc
Sets an error message occurred during locale file parsing.
_locale_import_parse_plural_forms in includes/locale.inc
Parses a Plural-Forms entry from a Gettext Portable Object file header
_locale_import_po in includes/locale.inc
Parses Gettext Portable Object file information and inserts into database
_menu_site_is_offline in includes/menu.inc
Checks whether the site is in maintenance mode.
_node_access_rebuild_batch_finished in modules/node/node.module
Post-processing for node_access_rebuild_batch.
_node_mass_update_batch_finished in modules/node/node.admin.inc
Node Mass Update Batch 'finished' callback.
_openid_invalid_openid_transition in modules/openid/openid.inc
Provides transition for accounts with possibly invalid OpenID identifiers in authmap.
_session_test_set_message in modules/simpletest/tests/session_test.module
Menu callback, sets a message to me displayed on the following page.
_simpletest_batch_finished in modules/simpletest/simpletest.module
_user_cancel in modules/user/user.module
Last batch processing step for cancelling a user account.

File

includes/bootstrap.inc, line 1755
Functions that need to be loaded on every Drupal request.

Code

<?php
function drupal_set_message($message = NULL, $type = 'status', $repeat = TRUE) {
  if ($message) {
    if (!isset($_SESSION['messages'][$type])) {
      $_SESSION['messages'][$type] = array();
    }

    if ($repeat || !in_array($message, $_SESSION['messages'][$type])) {
      $_SESSION['messages'][$type][] = $message;
    }

    // Mark this page as being uncacheable.
    drupal_page_is_cacheable(FALSE);
  }

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

Comments

Use drupal_get_messages to clear the current messages

You can use

drupal_get_messages('status');

to clear all status messages and leave errors intact.

Translate messages first

This function does not automatically translate messages so it is important to translate them first, e.g.:

<?php
  drupal_set_message
(t('Don\'t panic!'), 'warning');
?>

Trying to use this for debugging?

In Drupal 7 using drupal_set_message() or dsm() for debugging isn't the done thing.

Take a look at the new debug() function. It's good.

Better than dsm()?

Out of interest, why is it better than dsm()?

The devel's dsm() output is collapsed & nicely formatted, having debug in core is handy, but is there a good reason for not using dsm() if you have it available?

It'd be nice if t() was built in

It'd be nice if drupal_set_message had t() built in a la watchdog.

drupal_set_message($message = NULL, $args = NULL, $type = 'status', $repeat = TRUE)

drupal_set_message('Hello :name', array(':name' => $name));

Just a thought.

Custom message types and theming

Note that the $type parameter can be anything you like and is passed directly through to the rendered div's class attribute. For example the following:

drupal_set_message(t('Something horrible just happened.'),'nuke');

generates this HTML:
<div class="messages nuke"> Something horrible just happened.</div>

Which can be styled with the following CSS:

div.nuke, table tr.nuke {
    background-color: #FF5EBE;
}
div.nuke, .nuke {
    color: #6B3A61;
}
div.nuke {
    background-image: url("nuke.png");
    border-color: #FFFA00;
}

Be sure the background image "nuke.png" above is 24x24 pixels which will ensure the borders and padding work out nicely.

Login or register to post comments