handled another potential xhtml error: empty select when no members in group.
authornicolasconnault <nicolasconnault>
Fri, 30 Mar 2007 06:32:10 +0000 (06:32 +0000)
committernicolasconnault <nicolasconnault>
Fri, 30 Mar 2007 06:32:10 +0000 (06:32 +0000)
group/index.php

index 4ccce4e82cb87ebb9eea2fe9bb5de5f7d9bb5e34..8918f30cf72e3cf6cf5aff3c046b6424f6169733 100644 (file)
@@ -323,9 +323,12 @@ if ($success) {
     if (isset($userids)) { //&& is_array($userids)        
         // Put the groupings into a hash and sort them
         $user_names = groups_userids_to_user_names($userids, $courseid);
-
-        foreach ($user_names as $user) {
-            echo "<option value=\"{$user->id}\">{$user->name}</option>\n";
+        if(empty($user_names)) {
+            echo '<option>&nbsp;</option>';
+        } else {
+            foreach ($user_names as $user) {
+                echo "<option value=\"{$user->id}\">{$user->name}</option>\n";
+            }
         }
     } else { 
         // Print an empty option to avoid the XHTML error of having an empty select element