Index: webform.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/webform/webform.module,v
retrieving revision 1.196.2.69
diff -u -r1.196.2.69 webform.module
--- webform.module	5 Nov 2010 01:05:50 -0000	1.196.2.69
+++ webform.module	5 Nov 2010 01:37:56 -0000
@@ -495,7 +495,7 @@
       'arguments' => array('node' => NULL, 'teaser' => NULL, 'page' => NULL, 'form' => NULL, 'enabled' => NULL),
     ),
     'webform_view_messages' => array(
-      'arguments' => array('node' => NULL, 'teaser' => NULL, 'page' => NULL, 'submission_count' => NULL, 'limit_exceeded' => NULL, 'allowed_roles' => NULL),
+      'arguments' => array('node' => NULL, 'teaser' => NULL, 'page' => NULL, 'submission_count' => NULL, 'limit_exceeded' => NULL, 'allowed_roles' => NULL, 'cached' => FALSE),
     ),
     'webform_form' => array(
       'arguments' => array('form' => NULL),
@@ -1235,7 +1235,8 @@
 
   // Print out messages for the webform.
   if ($node->build_mode != NODE_BUILD_PREVIEW && !isset($node->webform_block) && !$logging_in) {
-    theme('webform_view_messages', $node, $teaser, $page, $submission_count, $limit_exceeded, $allowed_roles);
+    $cached = $user->uid == 0 && variable_get('cache', 0);
+    $messages = theme('webform_view_messages', $node, $teaser, $page, $submission_count, $limit_exceeded, $allowed_roles, $cached);
   }
 
   if (isset($output)) {
@@ -1283,12 +1284,17 @@
  *   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($node, $teaser, $page, $submission_count, $limit_exceeded, $allowed_roles) {
+function theme_webform_view_messages($node, $teaser, $page, $submission_count, $limit_exceeded, $allowed_roles, $cached = FALSE) {
   global $user;
 
   $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) {
