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 15 Jul 2010 21:38:30 -0000 @@ -58,6 +58,28 @@ 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['account']['data'] = array('#tree' => TRUE); + $form['account']['data']['overlay'] = array( + '#type' => 'checkbox', + '#prefix' => '

' . t('Overlay') . '

', + '#title' => t('Use the overlay for administrative pages.'), + '#description' => t('Show administrative pages on top of the page you started from.'), + '#default_value' => isset($account->data['overlay']) ? $account->data['overlay'] : 1, + '#weight' => 10, + ); + return $form; + } + } +} + + +/** * Implements hook_init(). * * Determine whether the current page request is destined to appear in the @@ -67,13 +89,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.