Index: modules/overlay/overlay.module =================================================================== RCS file: /cvs/drupal/drupal/modules/overlay/overlay.module,v retrieving revision 1.23 diff -u -p -r1.23 overlay.module --- modules/overlay/overlay.module 8 Jul 2010 12:20:23 -0000 1.23 +++ modules/overlay/overlay.module 11 Jul 2010 22:47:48 -0000 @@ -58,6 +58,38 @@ function overlay_theme() { } /** + * Implements hook_form_FORM_ID_alter(). + */ +function overlay_form_user_profile_form_alter(&$form, &$form_state) { + if ($form['#user_category'] == 'account') { + $account = $form['#user']; + if (user_access('access overlay', $account)) { + $form['overlay_control'] = array( + '#type' => 'fieldset', + '#title' => t('Administrative overlay'), + '#collapsible' => TRUE, + ); + + $form['overlay_control']['overlay'] = array( + '#type' => 'checkbox', + '#title' => t('View administrative pages in the overlay.'), + '#description' => t('The overlay shows administrative pages with a transparent black background over the page you started from.'), + '#default_value' => isset($account->data['overlay']) ? $account->data['overlay'] : 1, + ); + } + } +} + +/** + * Implements hook_user_presave(). + */ +function overlay_user_presave(&$edit, $account, $category) { + if (isset($edit['overlay'])) { + $edit['data']['overlay'] = $edit['overlay']; + } +} + +/** * Implements hook_init(). * * Determine whether the current page request is destined to appear in the @@ -67,13 +99,14 @@ function overlay_theme() { */ function overlay_init() { // @todo: custom_theme does not exist anymore. - global $custom_theme; + global $custom_theme, $user; $mode = overlay_get_mode(); // Only act if the user has access to the overlay and a mode was not already // set. Other modules can also enable the overlay directly for other uses. - if (empty($mode) && user_access('access overlay')) { + $use_overlay = !isset($user->data['overlay']) || $user->data['overlay']; + if (empty($mode) && user_access('access overlay') && $use_overlay) { $current_path = current_path(); // After overlay is enabled on the modules page, redirect to // #overlay=admin/modules to actually enable the overlay.