diff -urp blockcache/blockcache.module blockcache/blockcache.module --- blockcache/blockcache.module 2008-08-26 11:28:51.000000000 -0400 +++ blockcache/blockcache.module 2008-08-26 11:35:48.000000000 -0400 @@ -243,6 +243,7 @@ function blockcache_get_blocks() { * If the block is not cached or the cache is stale, get the info and stick it back into the cache. */ function blockcache_block_view($delta) { + global $theme; $cache_name = _blockcache_get_name($delta); $cached = cache_get($cache_name, 'cache_block'); if ($cached && ($cached->expire == CACHE_TEMPORARY || $cached->expire > time())) { @@ -252,7 +253,17 @@ function blockcache_block_view($delta) { else { // cache block $r = db_fetch_object(db_query("SELECT * FROM {bc_blocks} WHERE my_delta = %d", $delta)); - $block = module_invoke($r->module, 'block', 'view', $r->mod_delta); + // load this block for both the block module and the blockcache module + $get_block = db_fetch_object(db_query("SELECT * FROM {blocks} WHERE delta = '%d' AND module = 'block' AND theme = '%s'", $r->mod_delta, $theme)); + $block_data = db_fetch_object(db_query("SELECT * FROM {blocks} WHERE delta = %d AND module = 'blockcache' AND theme = '%s'", $delta, $theme)); + + // our blockcache copy of the block contains the region we want to use + $get_block->region = $block_data->region; + + // this is done to use any custom templates this block has + $block = Array('content' => theme('block', $get_block)); + + // package the block for db storage and figure out its life span $cache = serialize($block); $expire = is_numeric(variable_get('bc_life_'.$delta, '')) ? time() + variable_get('bc_life_'.$delta, '') : CACHE_TEMPORARY; cache_set($cache_name, 'cache_block', $cache, $expire);