"MDL-17143, don't display the user description at all when user isn't enrolled in any courses, merged and modified from 1.9"

This commit is contained in:
dongsheng 2008-11-10 03:06:27 +00:00
parent 7b825c4f6f
commit 35f0660ab4
6 changed files with 30 additions and 1 deletions

View file

@ -75,6 +75,13 @@ 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) {
$mform->removeElement('description');
}
// user can not change own auth method
if ($userid == $USER->id) {
$mform->hardFreeze('auth');