MDL-17143 Avoid notices caused by not existing profilesforenrolledusersonly setting

This commit is contained in:
stronk7
2008-11-11 18:31:07 +00:00
parent 4847ef9b3a
commit e9a53fb1ba
3 changed files with 4 additions and 3 deletions
+1 -1
View File
@@ -62,7 +62,7 @@ class user_edit_form extends moodleform {
}
// remove description
if (!get_record('role_assignments', 'userid', $userid) && empty($user->description) && $CFG->profilesforenrolledusersonly) {
if (!get_record('role_assignments', 'userid', $userid) && empty($user->description) && !empty($CFG->profilesforenrolledusersonly)) {
$mform->removeElement('description');
}
+1 -1
View File
@@ -79,7 +79,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 (!get_record('role_assignments', 'userid', $userid) && empty($user->description) && $CFG->profilesforenrolledusersonly && !$can_edit_user) {
if (!get_record('role_assignments', 'userid', $userid) && empty($user->description) && !empty($CFG->profilesforenrolledusersonly) && !$can_edit_user) {
$mform->removeElement('description');
}
+2 -1
View File
@@ -222,7 +222,7 @@
if ($user->description && !isset($hiddenfields['description'])) {
$has_courseid = ($course->id != SITEID);
if (!get_record('role_assignments', '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 />";
@@ -331,6 +331,7 @@
/// Print the Custom User Fields
profile_display_fields($user->id);
require_once($CFG->dirroot . '/blocks/extrafields/user_view.php');
if ($mycourses = get_my_courses($user->id, null, null, false, 21)) {
$shown=0;