MDL-17143 Avoid notices caused by not existing profilesforenrolledusersonly setting. Merged from 19_STABLE

This commit is contained in:
stronk7
2008-11-11 18:39:34 +00:00
parent c39f019849
commit 9af010ea4a
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -64,7 +64,7 @@ class user_edit_form extends moodleform {
if ($user = $DB->get_record('user', array('id'=>$userid))) {
// remove description
if (!$DB->get_record('role_assignments', array('userid'=>$userid)) && empty($user->description) && $CFG->profilesforenrolledusersonly) {
if (!$DB->get_record('role_assignments', array('userid'=>$userid)) && empty($user->description) && !empty($CFG->profilesforenrolledusersonly)) {
$mform->removeElement('description');
}
+1 -1
View File
@@ -78,7 +78,7 @@ class user_editadvanced_form extends moodleform {
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
$can_edit_user = has_capability('moodle/user:update', $sitecontext);
// remove description
if (!$DB->get_record('role_assignments', array('userid'=>$userid)) && empty($user->description) && $CFG->profilesforenrolledusersonly && !$can_edit_user) {
if (!$DB->get_record('role_assignments', array('userid'=>$userid)) && empty($user->description) && !empty($CFG->profilesforenrolledusersonly) && !$can_edit_user) {
$mform->removeElement('description');
}
+1 -1
View File
@@ -212,7 +212,7 @@
if ($user->description && !isset($hiddenfields['description'])) {
$has_courseid = ($course->id != SITEID);
if (!$DB->get_record('role_assignments', array('userid'=>$id))
&& !$has_courseid && $CFG->profilesforenrolledusersonly) {
&& !$has_courseid && !empty($CFG->profilesforenrolledusersonly)) {
echo get_string('profilenotshown', 'moodle').'<hr />';
} else {
echo format_text($user->description, FORMAT_MOODLE)."<hr />";