--- bbb.module	2010-09-23 12:25:45.000000000 -0400
+++ bbb.module.new	2011-01-26 15:04:24.000000000 -0500
@@ -57,6 +57,7 @@
     'moderate meetings',
     'moderate own meetings',
     'attend meetings',
+    'attend meetings with password',
   );
 }
 
@@ -137,7 +138,7 @@
 
   // Check for node access and access to attend meetings
   if (node_access('view', $node) &&
-     (user_access('attend meetings') || user_access('administer big blue button'))) {
+     (user_access('attend meetings') || user_access('attend meetings with password') || user_access('administer big blue button'))) {
     return TRUE;
   }
   return FALSE;
@@ -394,9 +395,9 @@
     if (!$teaser && $show) {
 
       $meeting = bbb_get_meeting($object->nid);
-      if (user_access('attend meetings') || user_access('administer big blue button')) {
+      if ((user_access('attend meetings') || user_access('administer big blue button')) && !user_access('attend meetings with password')) {
         $links['bbb_meeting_attend'] = array(
-          'title' => t('Attend meeting'),
+          'title' => t('Attend Meeting'),
           'href' => "node/$object->nid/meeting/attend",
         );
       }
@@ -602,18 +603,24 @@
   $url = array();
   $mode = 'attend';
   $meeting = bbb_get_meeting($node->nid);
-
+#  print "REQUEST['attendeePW'] = |{$_REQUEST['attendeePW']}|";
+#  print "meeting->attendeePW =".$meeting->attendeePW."<p>";
+#  print "access=".user_access('attend meetings with password')."<P>";
   $params = array(
-    'meetingID' => $meeting->meetingID,
-    'password' => $meeting->moderatorPW,
+		'meetingID' => $meeting->meetingID,
+		'password' => $meeting->moderatorPW,
   );
+
   $status = bbb_api_getMeetingInfo($params);
 
+  if ( user_access('attend meetings with password') && ($_REQUEST['attendeePW'] != $meeting->attendeePW)) {
+    drupal_set_message('Sorry, but you did not enter the correct password to attend this meeting as a guest.');
+    drupal_goto('node/' . $node->nid);
+  }
   if ($status->hasBeenForciblyEnded == 'true') {
     drupal_set_message('The meeting has been terminated and is not available for attending.');
     drupal_goto('node/' . $node->nid);
   }
-
   drupal_set_title($node->title);
   if ($meeting->running) {
     if (BBB_DISPLAY_MODE == 'blank') {
@@ -778,8 +785,11 @@
   if ($meeting->dialNumber) {
     $output .= '<div class="bbb-dial-number">' . t('Phone: @number', array('@number' => $meeting->dialNumber)) . '</div>';
   }
-  if (user_access('attend meetings') || user_access('administer big blue button')) {
-    $output .= '<div class="bbb-meeting-attend">' . l('Attend meeting', 'node/' . $meeting->nid . '/meeting/attend') . '</div>';
+  if (user_access('attend meetings with password')) {
+  	$output .= '<div class="bbb-meeting-attend"><form action="' .$meeting->nid . '/meeting/attend/" method="PUT"><ul><li>Affiliates: <a href="../user/login/">Click here</a> and enter user name and password</li><li>Guests: Enter Meeting Password provided by moderator<br><input type="password" name="attendeePW" size=20><input type="submit" name="Go"></li></ul></div>';
+  }
+  if ((user_access('attend meetings') || user_access('administer big blue button')) && !(user_access('attend meetings with password'))) {
+    $output .= '<div class="bbb-meeting-attend">' . l('Attend Meeting', 'node/' . $meeting->nid . '/meeting/attend') . '</div>';
   }
   if (user_access('moderate meetings') || user_access('administer big blue button')) {
     $output .= '<div class="bbb-meeting-moderate">' . l(t('Moderate meeting'), 'node/' . $meeting->nid . '/meeting/moderate') . '</div>';
