Index: flag.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/flag/Attic/flag.module,v
retrieving revision 1.1.2.60
diff -u -r1.1.2.60 flag.module
--- flag.module	10 Oct 2008 07:15:58 -0000	1.1.2.60
+++ flag.module	31 Oct 2008 15:54:37 -0000
@@ -810,7 +810,8 @@
     'content_id' => $content_id,
     'after_flagging' => $after_flagging,
   );
-  template_preprocess_flag($variables);
+  flag_template_preprocess('flag', $variables);
+
   extract($variables);
   ob_start();
   include $template;
@@ -887,7 +888,7 @@
     'content_id' => $content_id,
     'after_flagging' => $after_flagging,
   );
-  template_preprocess_flag($variables);
+  flag_template_preprocess('flag', $variables);
 
   // Prepare an array of suggested templates to try.
   $suggestions = array();
@@ -905,6 +906,25 @@
 }
 
 /**
+ * Call module flag preprocess functions for Drupal 5.
+ *
+ * The preprocess functions for themes and phptemplate can be done in
+ * _phptemplate_variables(), but this adds preprocessing to modules that don't
+ * have this access in Drupal 5.
+ *
+ * @param $hook
+ *   The name of the template file hook whose variables are being preprocessed.
+ * @param $variables
+ *   The existing variables that will be passed to the template file.
+ */
+function flag_template_preprocess($hook, &$variables) {
+  template_preprocess_flag($variables);
+  foreach (module_implements('preprocess_'. $hook) as $module) {
+    ${$module .'_preprocess_'. $hook}($variables);
+  }
+}
+
+/**
  * Format a string containing a count of items.
  *
  * _flag_format_plural() is a version of format_plural() which
