You are here

function user_dashboard_show_disabled in UserDashboard 7

AJAX callback to show disabled blocks in the dashboard customization mode.

1 string reference to 'user_dashboard_show_disabled'
user_dashboard_menu in ./user_dashboard.module
Implements hook_menu().

File

./user_dashboard.module, line 468
The User Dashboard module forks Drupal 7's awesome Dashboard module to provide an individual dashboard for each user on the site.

Code

function user_dashboard_show_disabled() {
  global $theme_key;
  $available = variable_get('user_dashboard_available_blocks', array());
  $user_blocks = db_select('user_dashboard_block')
    ->condition('theme', $theme_key)
    ->condition('status', 1)
    ->condition('uid', (int) arg(1))
    ->fields('user_dashboard_block')
    ->execute();
  foreach ($user_blocks as $item) {
    unset($available[$item->module . '_' . $item->delta]);
  }

  // Blocks are not necessarily initialized at this point.
  $blocks = _block_rehash();
  foreach ($blocks as $key => $block) {
    $id = $block['module'] . '_' . $block['delta'];
    if (!isset($available[$id]) || !$available[$id]) {
      unset($blocks[$key]);
    }
  }

  // Theme the output and end the page request.
  print theme('user_dashboard_disabled_blocks', array(
    'blocks' => $blocks,
  ));
  drupal_exit();
}