]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-18476 fixed default guest role display hint; merged from MOODLE_19_STABLE
authorskodak <skodak>
Fri, 8 May 2009 12:23:22 +0000 (12:23 +0000)
committerskodak <skodak>
Fri, 8 May 2009 12:23:22 +0000 (12:23 +0000)
admin/settings/users.php

index 9853c666aeb2a12902a07be24cc077b5be7f090f..01b141cd64f89aa571be4e4ce27a438e3ad9e4e9 100644 (file)
@@ -110,7 +110,12 @@ if ($hassiteconfig
             }
             if (!$guestroles = get_roles_with_capability('moodle/legacy:guest', CAP_ALLOW)) {
                 $guestroles = array();
+                $defaultguestid = null;
+            } else {
+                $defaultguestid = reset($guestroles);
+                $defaultguestid = $defaultguestid->id;
             }
+            
             // we must not use assignable roles here:
             //   1/ unsetting roles as assignable for admin might bork the settings!
             //   2/ default user role should not be assignable anyway
@@ -127,9 +132,9 @@ if ($hassiteconfig
             }
 
             $temp->add(new admin_setting_configselect('notloggedinroleid', get_string('notloggedinroleid', 'admin'),
-                          get_string('confignotloggedinroleid', 'admin'), $guestrole->id, $allroles ));
+                          get_string('confignotloggedinroleid', 'admin'), $defaultguestid, $allroles ));
             $temp->add(new admin_setting_configselect('guestroleid', get_string('guestroleid', 'admin'),
-                          get_string('configguestroleid', 'admin'), $guestrole->id, $allroles));
+                          get_string('configguestroleid', 'admin'), $defaultguestid, $allroles));
             $temp->add(new admin_setting_configselect('defaultuserroleid', get_string('defaultuserroleid', 'admin'),
                           get_string('configdefaultuserroleid', 'admin'), $userrole->id, $nonguestroles)); // guest role here breaks a lot of stuff
         }