--- admin.module.orig +++ admin.module @@ -374,6 +374,16 @@ $block->module = $module; $block->delta = $delta; $block->cache = is_numeric($cache) ? $cache : BLOCK_NO_CACHE; + // Get allowed rids for this block. + $result = db_query("SELECT rid FROM {blocks_roles} WHERE module = '%s' AND delta = '%s'", $module, $delta); + $block_rids = array(); + while ($rid = db_result($result)) { + $block_rids[] = $rid; + } + // Don't display the block if it is restricted to role(s) and the current user does not belong to one of the roles. + if (count($block_rids) && !count(array_intersect($block_rids, array_keys($GLOBALS['user']->roles))) && $GLOBALS['user']->uid != 1) { + continue; + } } if (!empty($block)) { if ($_SERVER['REQUEST_METHOD'] == 'GET' && $cid = admin_block_get_cache_id($block)) {