mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
"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:
parent
7b825c4f6f
commit
35f0660ab4
6 changed files with 30 additions and 1 deletions
|
@ -60,8 +60,14 @@ 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) {
|
||||
$mform->removeElement('description');
|
||||
}
|
||||
|
||||
// print picture
|
||||
if (!empty($CFG->gdversion)) {
|
||||
$image_el =& $mform->getElement('currentpicture');
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -210,7 +210,13 @@
|
|||
// Print the description
|
||||
|
||||
if ($user->description && !isset($hiddenfields['description'])) {
|
||||
echo format_text($user->description, FORMAT_MOODLE)."<hr />";
|
||||
$has_courseid = ($course->id != SITEID);
|
||||
if (!$DB->get_record('role_assignments', array('userid'=>$id))
|
||||
&& !$has_courseid && $CFG->profilesforenrolledusersonly) {
|
||||
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