I'm trying to customize comments on my site, and wanted to use the mytheme_preprocess_comment() functionality to alter some of the comment variables, so I followed the directions and uncommented the line that disables it.

But the function does not ever fire. I can even put deliberate errors into it (nonexistent function names, etc.) and the function is never called.

I've tried rebuilding the theme registry, clearing caches, etc.

Any pointers?

Comments

johnalbin’s picture

Category: bug » support
Status: Active » Postponed (maintainer needs more info)

They definitely work fine.

Did you rename the preprocess function from STARTERKIT_preprocess_comment to foo_preprocess_comment (where "foo" is the name of your sub-theme)? The "how to create a sub-theme" instructions say to do that.

geerlingguy’s picture

Component: Code » layout.css

For the airyblue theme, here's the code I used to get preprocess_comment to work (just FYI):

/**
 * Override or insert variables into the comment templates.
 *
 * @param $vars
 *   An array of variables to pass to the theme template.
 * @param $hook
 *   The name of the template being rendered ("comment" in this case.)
 */
function airyblue_preprocess_comment(&$vars, $hook) {
  if ($vars['status'] = 1) {
    $vars['classes_array'][] = 'comment-unpublished';
  }
}
akalata’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

Closing old and inactive support requests.