Merge branch 'MDL-56601-master-3' of git://github.com/cameron1729/moodle

This commit is contained in:
David Monllao
2016-11-08 12:25:31 +08:00
2 changed files with 21 additions and 1 deletions
+1
View File
@@ -1263,6 +1263,7 @@ Cheers from the \'{$a->sitename}\' administrator,
{$a->signoff}';
$string['newpicture'] = 'New picture';
$string['newpicture_help'] = 'To add a new picture, browse and select an image (in JPG or PNG format) then click "Update profile". The image will be cropped to a square and resized to 100x100 pixels.';
$string['newpictureusernotsetup'] = 'A profile picture can only be added once all required profile information has been saved.';
$string['newsectionname'] = 'New name for section {$a}';
$string['newsitem'] = 'news item';
$string['newsitems'] = 'news items';
+20 -1
View File
@@ -45,6 +45,7 @@ class user_edit_form extends moodleform {
$mform = $this->_form;
$editoroptions = null;
$filemanageroptions = null;
$usernotfullysetup = user_not_fully_set_up($USER);
if (!is_array($this->_customdata)) {
throw new coding_exception('invalid custom data for user_edit_form');
@@ -76,12 +77,30 @@ class user_edit_form extends moodleform {
useredit_shared_definition($mform, $editoroptions, $filemanageroptions, $user);
// Extra settigs.
if (!empty($CFG->disableuserimages)) {
if (!empty($CFG->disableuserimages) || $usernotfullysetup) {
$mform->removeElement('deletepicture');
$mform->removeElement('imagefile');
$mform->removeElement('imagealt');
}
// If the user isn't fully set up, let them know that they will be able to change
// their profile picture once their profile is complete.
if ($usernotfullysetup) {
$userpicturewarning = $mform->createElement('warning', 'userpicturewarning', 'notifymessage', get_string('newpictureusernotsetup'));
$enabledusernamefields = useredit_get_enabled_name_fields();
if ($mform->elementExists('moodle_additional_names')) {
$mform->insertElementBefore($userpicturewarning, 'moodle_additional_names');
} else if ($mform->elementExists('moodle_interests')) {
$mform->insertElementBefore($userpicturewarning, 'moodle_interests');
} else {
$mform->insertElementBefore($userpicturewarning, 'moodle_optional');
}
// This is expected to exist when the form is submitted.
$imagefile = $mform->createElement('hidden', 'imagefile');
$mform->insertElementBefore($imagefile, 'userpicturewarning');
}
// Next the customisable profile fields.
profile_definition($mform, $userid);