function overlay_user_dismiss_message

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.

File

modules/overlay/overlay.module, line 328
Displays the Drupal administration interface in an overlay.

Code

function overlay_user_dismiss_message() {
  global $user;
  // It's unlikely, but possible that "access overlay" permission is granted to
  // the anonymous role. In this case, we do not display the message to disable
  // the overlay, so there is nothing to dismiss. Also, protect against
  // cross-site request forgeries by validating a token.
  if (empty($user->uid) || !isset($_GET['token']) || !drupal_valid_token($_GET['token'], 'overlay')) {
    return MENU_ACCESS_DENIED;
  }
  else {
    user_save(user_load($user->uid), array('data' => array('overlay_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');
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!overlay!overlay.module/function/overlay_user_dismiss_message/7.x