From: skodak Date: Fri, 8 May 2009 12:23:22 +0000 (+0000) Subject: MDL-18476 fixed default guest role display hint; merged from MOODLE_19_STABLE X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=551935cfc62a8abce3f4ff6b02b212311d420cdb;p=moodle.git MDL-18476 fixed default guest role display hint; merged from MOODLE_19_STABLE --- diff --git a/admin/settings/users.php b/admin/settings/users.php index 9853c666ae..01b141cd64 100644 --- a/admin/settings/users.php +++ b/admin/settings/users.php @@ -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 }