This commit is contained in:
Ilya Tregubov 2023-05-09 11:30:24 +08:00
commit 4670bbb564
No known key found for this signature in database
GPG Key ID: 0F58186F748E55C1
4 changed files with 28 additions and 116 deletions

View File

@ -3351,6 +3351,27 @@ function get_all_user_name_fields($returnsql = false, $tableprefix = null, $pref
return $alternatenames;
}
/**
* @deprecated since Moodle 3.11 MDL-71051
*/
function profile_display_fields() {
throw new coding_exception(__FUNCTION__ . '() has been removed.');
}
/**
* @deprecated since Moodle 3.11 MDL-71051
*/
function profile_edit_category() {
throw new coding_exception(__FUNCTION__ . '() has been removed.');
}
/**
* @deprecated since Moodle 3.11 MDL-71051
*/
function profile_edit_field() {
throw new coding_exception(__FUNCTION__ . '() has been removed.');
}
/**
* Update a subscription from the form data in one of the rows in the existing subscriptions table.
*

View File

@ -509,52 +509,6 @@ function profile_save_category(stdClass $data): void {
profile_purge_user_fields_cache();
}
/**
* Edit a category
*
* @deprecated since Moodle 3.11 MDL-71051 - please do not use this function any more.
* @todo MDL-71413 This will be deleted in Moodle 4.3.
* @see profile_save_category()
*
* @param int $id
* @param string $redirect
*/
function profile_edit_category($id, $redirect) {
global $DB, $OUTPUT, $CFG;
debugging('Function profile_edit_category() is deprecated without replacement, see also profile_save_category()',
DEBUG_DEVELOPER);
$categoryform = new \core_user\form\profile_category_form();
if ($category = $DB->get_record('user_info_category', array('id' => $id))) {
$categoryform->set_data($category);
}
if ($categoryform->is_cancelled()) {
redirect($redirect);
} else {
if ($data = $categoryform->get_data()) {
profile_save_category($data);
redirect($redirect);
}
if (empty($id)) {
$strheading = get_string('profilecreatenewcategory', 'admin');
} else {
$strheading = get_string('profileeditcategory', 'admin', format_string($category->name));
}
// Print the page.
echo $OUTPUT->header();
echo $OUTPUT->heading($strheading);
$categoryform->display();
echo $OUTPUT->footer();
die;
}
}
/**
* Save updated field definition or create a new field
*
@ -596,53 +550,6 @@ function profile_save_field(stdClass $data, array $editors): void {
profile_reorder_categories();
}
/**
* Edit a profile field.
*
* @deprecated since Moodle 3.11 MDL-71051 - please do not use this function any more.
* @todo MDL-71413 This will be deleted in Moodle 4.3.
* @see profile_save_field()
*
* @param int $id
* @param string $datatype
* @param string $redirect
*/
function profile_edit_field($id, $datatype, $redirect) {
global $OUTPUT, $PAGE;
debugging('Function profile_edit_field() is deprecated without replacement, see also profile_save_field()',
DEBUG_DEVELOPER);
$fieldform = new \core_user\form\profile_field_form();
$fieldform->set_data_for_dynamic_submission();
if ($fieldform->is_cancelled()) {
redirect($redirect);
} else {
if ($data = $fieldform->get_data()) {
profile_save_field($data, $fieldform->editors());
redirect($redirect);
}
$datatypes = profile_list_datatypes();
if (empty($id)) {
$strheading = get_string('profilecreatenewfield', 'admin', $datatypes[$datatype]);
} else {
$strheading = get_string('profileeditfield', 'admin', format_string($fieldform->get_field_record()->name));
}
// Print the page.
$PAGE->navbar->add($strheading);
echo $OUTPUT->header();
echo $OUTPUT->heading($strheading);
$fieldform->display();
echo $OUTPUT->footer();
die;
}
}
/**
* Purge the cache for the user profile fields
*/

View File

@ -744,29 +744,6 @@ function profile_save_data(stdClass $usernew): void {
}
}
/**
* Display profile fields.
*
* @deprecated since Moodle 3.11 MDL-71051 - please do not use this function any more.
* @todo MDL-71413 This will be deleted in Moodle 4.3.
*
* @param int $userid
*/
function profile_display_fields($userid) {
debugging('Function profile_display_fields() is deprecated because it is no longer used and will be '.
'removed in future versions of Moodle', DEBUG_DEVELOPER);
$categories = profile_get_user_fields_with_data_by_category($userid);
foreach ($categories as $categoryid => $fields) {
foreach ($fields as $formfield) {
if ($formfield->is_visible() and !$formfield->is_empty()) {
echo html_writer::tag('dt', format_string($formfield->field->name));
echo html_writer::tag('dd', $formfield->display_data());
}
}
}
}
/**
* Retrieves a list of profile fields that must be displayed in the sign-up form.
*

View File

@ -1,5 +1,12 @@
This files describes API changes for code that uses the user API.
=== 4.3 ===
* The following previously deprecated methods have been removed and can no longer be used:
- `profile_display_fields`
- `profile_edit_category`
- `profile_edit_field`
=== 4.2 ===
* Added get_internalfield_list() and get_internalfields() in the user_field_mapping class.