Index: modules/overlay/overlay.module =================================================================== RCS file: /cvs/drupal/drupal/modules/overlay/overlay.module,v retrieving revision 1.22 diff -u -p -r1.22 overlay.module --- modules/overlay/overlay.module 13 Jun 2010 05:47:47 -0000 1.22 +++ modules/overlay/overlay.module 25 Jun 2010 14:23:32 -0000 @@ -58,6 +58,26 @@ 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', + '#title' => t('View administrative pages in the overlay.'), + '#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 +87,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.