MDL-24530 Fixed core functions usage during early install phase when the site is not fully set up yet

This commit is contained in:
David Mudrak
2010-10-06 08:50:31 +00:00
parent ec7e6c6de8
commit ee8dd77f75
2 changed files with 5 additions and 4 deletions
+4 -2
View File
@@ -2605,8 +2605,10 @@ class admin_setting_users_with_capability extends admin_setting_configmultiselec
'$@NONE@$' => get_string('nobody'),
'$@ALL@$' => get_string('everyonewhocan', 'admin', get_capability_string($this->capability)),
);
foreach ($users as $user) {
$this->choices[$user->username] = fullname($user);
if (is_array($users)) {
foreach ($users as $user) {
$this->choices[$user->username] = fullname($user);
}
}
return true;
}
+1 -2
View File
@@ -2683,7 +2683,6 @@ function ismoving($courseid) {
* @param bool $override If true then the name will be first name followed by last name rather than adhering to fullnamedisplay setting.
*/
function fullname($user, $override=false) {
global $CFG, $SESSION;
if (!isset($user->firstname) and !isset($user->lastname)) {
@@ -2703,7 +2702,7 @@ function fullname($user, $override=false) {
$CFG->fullnamedisplay = $SESSION->fullnamedisplay;
}
if ($CFG->fullnamedisplay == 'firstname lastname') {
if (!isset($CFG->fullnamedisplay) or $CFG->fullnamedisplay === 'firstname lastname') {
return $user->firstname .' '. $user->lastname;
} else if ($CFG->fullnamedisplay == 'lastname firstname') {