i am having an issue where hook_preprocess_page 's changes to &$variables is not being rendered, even though it is the last item under $theme_registry['page']['preprocess functions']. logging contents of $variables to a file show the contents changed, but contents appear unchanged on the site. flushed all cache on drupal, flushed all browser caches and still the same result.

/**
 * Implementation of hook_preprocess_page().
 */
function grinchlist_preprocess_page(&$variables) {

  if (grinchlist_usercheck($variables['user']['uid'])) {
    $variables['scripts'] = preg_replace('/<script[^>]*christmas_snow.*<\/script>/','',$variables['scripts']);
  }
  file_put_contents('/tmp/vars.txt',print_r($variables,true));
}

the /tmp/vars.txt shows the variables properly, but the browser still show the script being loaded.

this may be a silly example, but i've had this issue with the hook_preprocess_page in other instances and it would really help out to understand what is going on here...

thanks.

Comments

jaypan’s picture

That's a head scratcher. Looks fine to me. Let us know if you figure out a solution.

Contact me to contract me for D7 -> D10/11 migrations.