Per this question, Can I modify guestbook.module safely? I have overridden theme_guestbook_entry() from the guestbook.module file. The problem is that my modifications are not taking effect. (Yes, I rebuilt the cache.)

I am following these instruction here, http://drupal.org/node/11811. I notice they don't mention contributed modules at all. Am I able to override these?


1 Answer 1


The page you are referring is for Drupal 5.

In Drupal 6, you alter a theme function defined in a module by defining the theme function, as in the following code. (Replace mytheme with the short name of your theme.)

// Drupal 6
function mytheme_guestbook_entry($uid, $entry, $comment_entry = NULL, $zebra, $confirm_delete = FALSE) {
  // Your own code.
// Drupal 7
function mytheme_guestbook_entry($variables) {
  // … 

In Drupal 7, if you just want to alter the variables passed to the theme function, you need to implement the preprocess function for that theme function.

function mymodule_preprocess_guestbook_entry(&$variables) {
  // Alter the values passed to the function, such as $variables['uid'], $variables['entry'],
  // $variables['comment_entry'], $variables['zebra'], or $variables['confirm_delete'].

The code I shown works whatever a theme function is implemented in Drupal, or a third-party module.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.