Preventing a block's custom template file from being cached I have built a module that needs to provide a small piece of dynamic content on every page load of a certain content type. It works great, however the section of code I provided is always cached in Drupal theme registry (it seems). The Variables I need generated on each pageload are "$userpicturepath" and "$variables['userfullname']" How do I prevent this from being cached? For completeness, here is my module's code:

subscribe_blocks.module

//implementation of hook_block_info
function subscribe_blocks_block_info() {    
    $blocks['author_subscribe_block'] = array(
        'info' =&gt; t('Author Subscribe Block'),
        'cache' =&gt; DRUPAL_NO_CACHE,
    );
    return $blocks;
}

//implementation of hook_block_view
function subscribe_blocks_block_view($delta = '') {
    switch ($delta) {
        case 'author_subscribe_block':
            $blocks['content'] = theme('subscribe_blocks_block');
            break;
    }
    return $blocks;
}


// Implementation of hook_theme
function subscribe_blocks_theme(){
    if ( arg(0) == 'node' &amp;&amp; is_numeric(arg(1)) ) {
        $node = node_load(arg(1));
    }
    $user_fields = user_load($node-&gt;uid);

    return array(
        'subscribe_blocks_block' =&gt; array(
            'template' =&gt; 'subscribeblocks',
            'variables' =&gt; array( 
                'userfullname' =&gt; $user_fields-&gt;field_name['und'][0]['safe_value'],
                'userpicture' =&gt; $user_fields-&gt;picture-&gt;filename,
                'userfields' =&gt; $user_fields,
            ),
        ),
    );
}


subscribeblocks.tpl.php

&lt;?php
drupal_page_is_cacheable(FALSE);

if ($variables['userpicture'] != NULL){
    $userpicturepath = 'sites/example.com/files/styles/user_profile/public/pictures/' . $variables['userpicture']; 
} else{
    $userpicturepath = 'https://someimgurl';
}
?&gt;

&lt;div class='subscribe-bar'&gt;
    &lt;div class='container'&gt;
        &lt;div class='col-sm-9 col-sm-offset-2'&gt;
            &lt;div class='subscribe-left'&gt;
                &lt;img src=&lt;?php echo $userpicturepath; ?&gt; class='subscribeuserpic' &gt;
            &lt;/div&gt;
            &lt;div class='subscribe-right'&gt;
                &lt;p&gt;Never miss another story by &lt;strong&gt;&lt;?php echo($variables['userfullname']); ?&gt;&lt;/strong&gt;. Subscribe today.&lt;/p&gt;
                &lt;div class='slideInFormContainer'&gt;
                    &lt;?php
                    $block = module_invoke('webform', 'block_view', 'client-block-5401');
                    print render($block['content']);
                    ?&gt;
                &lt;/div&gt;
            &lt;/div&gt;
        &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


I'm using Drupal 7, have all other caching turned off (for now), and have tried using several modules including CacheExclude (https://www.drupal.org/project/cacheexclude) and Ajax Blocks (https://www.drupal.org/project/ajaxblocks).
Probably not the best way to do this, but I was able to overcome this by rebuilding the theme cache when this block was run using:

&lt;?php
drupal_theme_rebuild();


I'd love if someone could help with a better answer though!