mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 17:36:38 +02:00
MDL-17143
don't display the user description at all when user isn't enrolled in any courses, backported to 1.8
This commit is contained in:
parent
61f34d4260
commit
7e62718e7c
6 changed files with 32 additions and 1 deletions
|
@ -54,6 +54,13 @@ class user_edit_form extends moodleform {
|
|||
}
|
||||
}
|
||||
|
||||
// remove description
|
||||
if (empty($user->description) && !empty($CFG->profilesforenrolledusersonly) && !record_exists('role_assignments', 'userid', $userid)) {
|
||||
if ($mform->elementExists('description')) {
|
||||
$mform->removeElement('description');
|
||||
}
|
||||
}
|
||||
|
||||
if ($user = get_record('user', 'id', $userid)) {
|
||||
|
||||
// print picture
|
||||
|
|
|
@ -70,6 +70,15 @@ class user_editadvanced_form extends moodleform {
|
|||
}
|
||||
}
|
||||
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$can_edit_user = has_capability('moodle/user:update', $sitecontext);
|
||||
if (empty($user->description) && !empty($CFG->profilesforenrolledusersonly) && !$can_edit_user && !record_exists('role_assignments', 'userid', $userid)) {
|
||||
// remove description
|
||||
if ($mform->elementExists('description')) {
|
||||
$mform->removeElement('description');
|
||||
}
|
||||
}
|
||||
|
||||
// user can not change own auth method
|
||||
if ($userid == $USER->id) {
|
||||
$mform->hardFreeze('auth');
|
||||
|
|
|
@ -201,7 +201,13 @@
|
|||
// Print the description
|
||||
|
||||
if ($user->description && !isset($hiddenfields['description'])) {
|
||||
echo format_text($user->description, FORMAT_MOODLE)."<hr />";
|
||||
$has_courseid = ($course->id != SITEID);
|
||||
if (!$has_courseid && !empty($CFG->profilesforenrolledusersonly)
|
||||
&& !record_exists('role_assignments', 'userid', $id)) {
|
||||
echo get_string('profilenotshown', 'moodle').'<hr />';
|
||||
} else {
|
||||
echo format_text($user->description, FORMAT_MOODLE)."<hr />";
|
||||
}
|
||||
}
|
||||
|
||||
// Print all the little details in a list
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue