function overlay_user_dismiss_message

Page callback: Dismisses the overlay accessibility message for this user.

Return value

A render array for a page containing a list of content.

See also

overlay_user_dismiss_message_access()

overlay_menu()

1 string reference to 'overlay_user_dismiss_message'
overlay_menu in drupal/core/modules/overlay/overlay.module
Implements hook_menu()

File

drupal/core/modules/overlay/overlay.module, line 348
Displays the Drupal administration interface in an overlay.

Code

function overlay_user_dismiss_message() {
  global $user;

  // @todo CSRF tokens are validated in page callbacks rather than access
  //   callbacks, because access callbacks are also invoked during menu link
  //   generation. Add token support to routing: http://drupal.org/node/755584.
  $token = drupal_container()
    ->get('request')->query
    ->get('token');
  if (!isset($token) || !drupal_valid_token($token, 'overlay')) {
    throw new AccessDeniedHttpException();
  }
  drupal_container()
    ->get('user.data')
    ->set('overlay', $user->uid, 'message_dismissed', 1);
  drupal_set_message(t('The message has been dismissed. You can change your overlay settings at any time by visiting your profile page.'));

  // Destination is normally given. Go to the user profile as a fallback.
  drupal_goto('user/' . $user->uid . '/edit');
}