You are here

function user_dashboard_block_list_alter in UserDashboard 7

Implements hook_block_list_alter().

Skip rendering dashboard blocks when not on the dashboard page itself. This prevents expensive dashboard blocks from causing performance issues on pages where they will never be displayed.

File

./user_dashboard.module, line 184
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_block_list_alter(&$blocks) {
  if (!_user_dashboard_visible()) {
    foreach ($blocks as $key => $block) {
      if (in_array($block->region, _user_dashboard_regions())) {
        unset($blocks[$key]);
      }
    }
  }
}