Index: webform.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/webform/webform.module,v
retrieving revision 1.269
diff -u -r1.269 webform.module
--- webform.module	5 Nov 2010 01:05:53 -0000	1.269
+++ webform.module	5 Nov 2010 01:48:26 -0000
@@ -511,7 +511,7 @@
       'render element' => 'webform',
     ),
     'webform_view_messages' => array(
-      'variables' => array('node' => NULL, 'teaser' => NULL, 'page' => NULL, 'submission_count' => NULL, 'limit_exceeded' => NULL, 'allowed_roles' => NULL),
+      'variables' => array('node' => NULL, 'teaser' => NULL, 'page' => NULL, 'submission_count' => NULL, 'limit_exceeded' => NULL, 'allowed_roles' => NULL, 'cached' => FALSE),
     ),
     'webform_form' => array(
       'render element' => 'form',
@@ -1262,7 +1262,8 @@
 
   // Print out messages for the webform.
   if (empty($node->in_preview) && !isset($node->webform_block) && !$logging_in) {
-    theme('webform_view_messages', array('node' => $node, 'teaser' => $teaser, 'page' => $page, 'submission_count' => $submission_count, 'limit_exceeded' => $limit_exceeded, 'allowed_roles' => $allowed_roles));
+    $cached = $user->uid == 0 && variable_get('cache', 0);
+    theme('webform_view_messages', array('node' => $node, 'teaser' => $teaser, 'page' => $page, 'submission_count' => $submission_count, 'limit_exceeded' => $limit_exceeded, 'allowed_roles' => $allowed_roles, 'cached' => $cached));
   }
 
   // Add the output to the node.
@@ -1316,6 +1317,12 @@
  *   Boolean value if the submission limit for this user has been exceeded.
  * @param $allowed_roles
  *   A list of user roles that are allowed to submit this webform.
+ * @param $cached
+ *   Whether the page contents are being cached. Messages that are user-specific
+ *   should not be shown when the page is cached, otherwise the message may be
+ *   shown to other users. Some messages should always be shown even if the page
+ *   is cached, such as "Submissions for this form are closed", because they
+ *   apply to all users equally.
  */
 function theme_webform_view_messages($variables) {
   global $user;
@@ -1326,9 +1333,9 @@
   $submission_count = $variables['submission_count'];
   $limit_exceeded = $variables['limit_exceeded'];
   $allowed_roles = $variables['allowed_roles'];
+  $cached = $variables['cached'];
 
   $type = 'notice';
-  $cached = $user->uid == 0 && variable_get('cache', 0);
 
   // If not allowed to submit the form, give an explanation.
   if (array_search(TRUE, $allowed_roles) === FALSE && $user->uid != 1) {
