Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.
/user/ -> editlib.php (source)

Differences Between: [Versions 310 and 400] [Versions 311 and 400] [Versions 39 and 400] [Versions 400 and 401] [Versions 400 and 402] [Versions 400 and 403]

This file contains function used when editing a users profile and preferences.

Copyright: 1999 Martin Dougiamas http://dougiamas.com
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 500 lines (20 kb)
Included or required:0 times
Referenced: 5 times
Includes or requires: 0 files

Defines 12 functions


Functions that are not part of a class:

cancel_email_update($userid)   X-Ref
Cancels the requirement for a user to update their email address.

param: int $userid

useredit_setup_preference_page($userid, $courseid)   X-Ref
Performs the common access checks and page setup for all
user preference pages.

return: array containing the user and course records.
param: int $userid The user id to edit taken from the page params.
param: int $courseid The optional course id if we came from a course context.

useredit_load_preferences(&$user, $reload=true)   X-Ref
Loads the given users preferences into the given user object.

param: stdClass $user The user object, modified by reference.
param: bool $reload

useredit_update_user_preference($usernew)   X-Ref
Updates the user preferences for the given user

Only preference that can be updated directly will be updated here. This method is called from various WS
updating users and should be used when updating user details. Plugins may list preferences that can
be updated by defining 'user_preferences' callback, {@see core_user::fill_preferences_cache()}

Some parts of code may use user preference table to store internal data, in these cases it is acceptable
to call set_user_preference()

param: stdClass|array $usernew object or array that has user preferences as attributes with keys starting with preference_

useredit_update_picture()   X-Ref


useredit_update_bounces($user, $usernew)   X-Ref
Updates the user email bounce + send counts when the user is edited.

param: stdClass $user The current user object.
param: stdClass $usernew The updated user object.

useredit_update_trackforums($user, $usernew)   X-Ref
Updates the forums a user is tracking when the user is edited.

param: stdClass $user The original user object.
param: stdClass $usernew The updated user object.

useredit_update_interests($user, $interests)   X-Ref
Updates a users interests.

param: stdClass $user
param: array $interests

useredit_shared_definition(&$mform, $editoroptions, $filemanageroptions, $user)   X-Ref
Powerful function that is used by edit and editadvanced to add common form elements/rules/etc.

param: moodleform $mform
param: array $editoroptions
param: array $filemanageroptions
param: stdClass $user

useredit_get_required_name_fields()   X-Ref
Return required user name fields for forms.

return: array required user name fields in order according to settings.

useredit_get_enabled_name_fields()   X-Ref
Gets enabled (from fullnameformate setting) user name fields in appropriate order.

return: array Enabled user name fields.

useredit_get_disabled_name_fields($enabledadditionalusernames = null)   X-Ref
Gets user name fields not enabled from the setting fullnamedisplay.

return: array Disabled user name fields.
param: array $enabledadditionalusernames Current enabled additional user name fields.