Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
|
Namespaces | |
namespace | core_user |
| |
namespace | core_user\analytics\indicator |
| |
namespace | core_user\external |
| |
namespace | core_user\form |
| |
namespace | core_user\hook |
| |
namespace | core_user\output |
| |
namespace | core_user\output\myprofile |
| |
namespace | core_user\privacy |
| |
namespace | core_user\reportbuilder\datasource |
| |
namespace | core_user\search |
| |
namespace | core_user\table |
| |
Classes | |
class | behat_user |
Steps definitions for users. More... | |
class | core_user\analytics\indicator\user_profile_set |
User profile set indicator. More... | |
class | core_user\analytics\indicator\user_track_forums |
User tracks forums indicator. More... | |
class | core_user\external\search_identity |
class | core_user\external\user_summary_exporter |
Class for exporting a user summary from an stdClass. More... | |
class | core_user\fields |
class | core_user\form\calendar_form |
Class user_edit_calendar_form. More... | |
class | core_user\form\contactsitesupport_form |
class | core_user\form\contentbank_user_preferences_form |
class | core_user\form\defaulthomepage_form |
Form class. More... | |
class | core_user\form\private_files |
class | core_user\form\profile_category_form |
class | core_user\form\profile_field_form |
class | core_user\hook\after_login_completed |
class | core_user\hook\before_user_deleted |
class | core_user\hook\before_user_updated |
class | core_user\hook\extend_bulk_user_actions |
class | core_user\output\myprofile\manager |
Defines MAnager class for myprofile navigation tree. More... | |
class | core_user\output\myprofile\node |
Defines a node in my profile page navigation. More... | |
class | core_user\output\myprofile\renderer |
Report log renderer's for printing reports. More... | |
class | core_user\output\participants_filter |
Class for rendering user filters on the course participants page. More... | |
class | core_user\output\status_field |
Class containing the data for the status field. More... | |
class | core_user\output\user_roles_editable |
class | core_user\privacy\provider |
Privacy class for requesting user data. More... | |
class | core_user\reportbuilder\datasource\users |
class | core_user\search\course_teacher |
Search for user role assignment in a course. More... | |
class | core_user\search\user |
Search area for Users for whom I have access to view profile. More... | |
class | core_user\table\participants |
Class for the displaying the participants table. More... | |
class | core_user\table\participants_search |
Class used to fetch participants based on a filterset. More... | |
class | core_user_external |
class | core_user_renderer |
Provides user rendering functionality such as printing private files tree and displaying a search utility. More... | |
class | group_members_selector |
User selector subclass for the list of users who are in a certain group. More... | |
class | group_non_members_selector |
User selector subclass for the list of users who are not in a certain group. More... | |
class | groups_user_selector_base |
Base class to avoid duplicating code. More... | |
class | profile_define_base |
Class profile_define_base. More... | |
class | user_active_filter_form |
Class user_active_filter_form. More... | |
class | user_add_filter_form |
Class user_add_filter_form. More... | |
class | user_edit_editor_form |
Class user_edit_editor_form. More... | |
class | user_edit_form |
Class user_edit_form. More... | |
class | user_edit_forum_form |
Class user_edit_forum_form. More... | |
class | user_edit_language_form |
Class user_edit_form. More... | |
class | user_editadvanced_form |
Class user_editadvanced_form. More... | |
class | user_filter_anycourses |
User filter to distinguish users with no or any enroled courses. More... | |
class | user_filter_checkbox |
Generic filter based for checkbox and can be used for disabling items. More... | |
class | user_filter_cohort |
Generic filter for cohort membership. More... | |
class | user_filter_courserole |
User filter based on roles in a course identified by its shortname. More... | |
class | user_filter_date |
Generic filter based on a date. More... | |
class | user_filter_globalrole |
User filter based on global roles. More... | |
class | user_filter_profilefield |
User filter based on values of custom profile fields. More... | |
class | user_filter_select |
Generic filter based on a list of values. More... | |
class | user_filter_simpleselect |
Generic filter based on a list of values. More... | |
class | user_filter_text |
Generic filter for text fields. More... | |
class | user_filter_type |
The base user filter class. More... | |
class | user_filter_yesno |
Generic yes/no filter with radio buttons for integer fields. More... | |
class | user_filtering |
User filtering wrapper class. More... | |
class | user_selector_base |
Base class for user selectors. More... | |
Functions | |
static | add_user_device ($appid, $name, $model, $platform, $version, $pushid, $uuid, $publickey=null) |
Add a user device in Moodle database (for PUSH notifications usually). | |
static | add_user_device_parameters () |
Returns description of method parameters. | |
static | add_user_device_returns () |
Returns description of method result value. | |
static | add_user_private_files ($draftid) |
Copy files from a draft area to users private files area. | |
static | add_user_private_files_parameters () |
Returns description of method parameters. | |
static | add_user_private_files_returns () |
Returns description of method result value. | |
static | agree_site_policy () |
Agree the site policy for the current user. | |
static | agree_site_policy_parameters () |
Returns description of method parameters. | |
static | agree_site_policy_returns () |
Returns description of method result value. | |
can_view_user_details_cap ($user, $course=null) | |
Check if $USER have the necessary capabilities to obtain user details. | |
cancel_email_update ($userid) | |
Cancels the requirement for a user to update their email address. | |
core_user_inplace_editable ($itemtype, $itemid, $newvalue) | |
Callback for inplace editable API. | |
static | get_course_user_profiles ($userlist) |
Get course participant's details. | |
static | get_course_user_profiles_parameters () |
Returns description of method parameters. | |
static | get_course_user_profiles_returns () |
Returns description of method result value. | |
static | get_private_files_info ($userid=0) |
Returns general information about files in the user private files area. | |
static | get_private_files_info_parameters () |
Returns description of method parameters. | |
static | get_private_files_info_returns () |
Returns description of method result value. | |
static | get_user_preferences ($name='', $userid=0) |
Return user preferences. | |
static | get_user_preferences_parameters () |
Returns description of method parameters. | |
static | get_user_preferences_returns () |
Returns description of method result value. | |
static | get_users ($criteria=array()) |
Retrieve matching user. | |
static | get_users_by_field_returns () |
Returns description of method result value. | |
static | get_users_parameters () |
Returns description of get_users() parameters. | |
static | get_users_returns () |
Returns description of get_users result value. | |
profile_delete_category ($id) | |
Delete a profile category. | |
profile_delete_field ($id) | |
Deletes a profile field. | |
profile_list_categories () | |
Retrieve a list of categories and ids suitable for use in a form. | |
profile_list_datatypes () | |
Retrieve a list of all the available data types. | |
profile_move_category ($id, $move) | |
Change the sort order of a category. | |
profile_move_field ($id, $move) | |
Change the sort order of a field. | |
profile_purge_user_fields_cache () | |
Purge the cache for the user profile fields. | |
profile_reorder_categories () | |
Reorder the profile categoriess starting at the category at the given startorder. | |
profile_reorder_fields () | |
Reorder the profile fields within a given category starting at the field at the given startorder. | |
profile_save_category (stdClass $data) | |
Create or update a profile category. | |
profile_save_field (stdClass $data, array $editors) | |
Save updated field definition or create a new field. | |
static | remove_user_device ($uuid, $appid="") |
Remove a user device from the Moodle database (for PUSH notifications usually). | |
static | remove_user_device_parameters () |
Returns description of method parameters. | |
static | remove_user_device_returns () |
Returns description of method result value. | |
static | set_user_preferences ($preferences) |
Set user preferences. | |
static | set_user_preferences_parameters () |
Returns description of method parameters. | |
static | set_user_preferences_returns () |
Returns description of method result value. | |
static | update_picture ($draftitemid, $delete=false, $userid=0) |
Update or delete the user picture in the site. | |
static | update_picture_parameters () |
Returns description of method parameters. | |
static | update_picture_returns () |
Returns description of method result value. | |
user_add_password_history (int $userid, #[\SensitiveParameter] string $password) | |
Add password to the list of used hashes for this user. | |
user_can_view_profile ($user, $course=null, $usercontext=null) | |
Check if the current user has permission to view details of the supplied user. | |
user_convert_text_to_menu_items ($text, $page) | |
Converts a string into a flat array of menu items, where each menu items is a stdClass with fields type, url, title. | |
user_count_login_failures ($user, $reset=true) | |
Count the number of failed login attempts for the given user, since last successful login. | |
user_create_user ($user, $updatepassword=true, $triggerevent=true) | |
Creates a user. | |
user_delete_user ($user) | |
Marks user deleted in internal user database and notifies the auth plugin. | |
static | user_description ($additionalfields=array()) |
Create user return value description. | |
user_edit_map_field_purpose ($userid, $fieldname) | |
Map an internal field name to a valid purpose from: "https://www.w3.org/TR/WCAG21/#input-purposes". | |
user_get_course_lastaccess_sql ($accesssince=null, $tableprefix='ul', $haveaccessed=false) | |
Returns SQL that can be used to limit a query to a period where the user last accessed / did not access a course. | |
user_get_default_fields () | |
Returns the list of default 'displayable' fields. | |
user_get_lastaccess_sql ($columnname, $accesssince, $tableprefix, $haveaccessed=false) | |
Returns SQL that can be used to limit a query to a period where the user last accessed or did not access something recorded by a given table. | |
user_get_tagged_users ($tag, $exclusivemode=false, $fromctx=0, $ctx=0, $rec=1, $page=0) | |
Returns users tagged with a specified tag. | |
user_get_user_details ($user, $course=null, array $userfields=array()) | |
Give user record from mdl_user, build an array contains all user details. | |
user_get_user_details_courses ($user, array $userfields=[]) | |
Tries to obtain user details, either recurring directly to the user's system profile or through one of the user's course enrollments (course profile). | |
user_get_user_lastaccess_sql ($accesssince=null, $tableprefix='u', $haveaccessed=false) | |
Returns SQL that can be used to limit a query to a period where the user last accessed / did not access the system. | |
user_get_user_navigation_info ($user, $page, $options=array()) | |
Get a list of essential user navigation items. | |
user_get_users_by_id ($userids) | |
Get users by id. | |
user_is_previously_used_password ($userid, $password) | |
Was this password used before on change or reset password page? | |
user_list_view ($course, $context) | |
Trigger user_list_viewed event. | |
user_mygrades_url ($userid=null, $courseid=SITEID) | |
Returns the url to use for the "Grades" link in the user navigation. | |
user_page_type_list ($pagetype, $parentcontext, $currentcontext) | |
Return a list of page types. | |
user_remove_user_device ($uuid, $appid="") | |
Remove a user device from the Moodle database (for PUSH notifications usually). | |
user_update_device_public_key (string $uuid, string $appid, string $publickey) | |
Update the users public key for the specified device and app. | |
user_update_user ($user, $updatepassword=true, $triggerevent=true) | |
Update a user with a user object (will compare against the ID) | |
useredit_get_disabled_name_fields ($enabledadditionalusernames=null) | |
Gets user name fields not enabled from the setting fullnamedisplay. | |
useredit_get_enabled_name_fields () | |
Gets enabled (from fullnameformate setting) user name fields in appropriate order. | |
useredit_get_required_name_fields () | |
Return required user name fields for forms. | |
useredit_load_preferences (&$user, $reload=true) | |
Loads the given users preferences into the given user object. | |
useredit_setup_preference_page ($userid, $courseid) | |
Performs the common access checks and page setup for all user preference pages. | |
useredit_shared_definition (&$mform, $editoroptions, $filemanageroptions, $user) | |
Powerful function that is used by edit and editadvanced to add common form elements/rules/etc. | |
useredit_update_bounces ($user, $usernew) | |
Updates the user email bounce + send counts when the user is edited. | |
useredit_update_interests ($user, $interests) | |
Updates a users interests. | |
useredit_update_picture () | |
useredit_update_trackforums ($user, $usernew) | |
Updates the forums a user is tracking when the user is edited. | |
useredit_update_user_preference ($usernew) | |
Updates the user preferences for the given user. | |
static | view_user_list ($courseid) |
Trigger the user_list_viewed event. | |
static | view_user_list_parameters () |
Returns description of method parameters. | |
static | view_user_list_returns () |
Returns description of method result value. | |
static | view_user_profile ($userid, $courseid=0) |
Trigger the user profile viewed event. | |
static | view_user_profile_parameters () |
Returns description of method parameters. | |
static | view_user_profile_returns () |
Returns description of method result value. | |
Variables | |
global | core_user\table::$CFG |
core_user\form::if (!defined( 'MOODLE_INTERNAL')) | |
if (!defined( 'MOODLE_INTERNAL')) | |
if (!defined( 'MOODLE_INTERNAL')) | |
if (!defined( 'MOODLE_INTERNAL')) | |
if (!defined( 'MOODLE_INTERNAL')) | |
if (!defined( 'MOODLE_INTERNAL')) | |
const | PROFILE_VISIBLE_ALL '2' |
Visible to anyone who can view the user. | |
const | PROFILE_VISIBLE_NONE '0' |
Only visible to users with the moodle/user:viewalldetails capability. | |
const | PROFILE_VISIBLE_PRIVATE '1' |
Visible to the profile owner or anyone with the moodle/user:viewalldetails capability. | |
const | PROFILE_VISIBLE_TEACHERS '3' |
Visible to anyone who has the moodle/site:viewuseridentity permission. | |
const | USER_FILTER_ENROLMENT 1 |
const | USER_FILTER_GROUP 2 |
const | USER_FILTER_LAST_ACCESS 3 |
const | USER_FILTER_ROLE 4 |
const | USER_FILTER_STATUS 5 |
const | USER_FILTER_STRING 6 |
const | USER_SELECTOR_DEFAULT_ROWS 20 |
The default size of a user selector. | |
|
static |
Add a user device in Moodle database (for PUSH notifications usually).
moodle_exception |
string | $appid | The app id, usually something like com.moodle.moodlemobile. |
string | $name | The device name, occam or iPhone etc. |
string | $model | The device model Nexus4 or iPad1.1 etc. |
string | $platform | The device platform iOs or Android etc. |
string | $version | The device version 6.1.2 or 4.2.2 etc. |
string | $pushid | The device PUSH token/key/identifier/registration id. |
string | $uuid | The device UUID. |
string | $publickey | The app generated public key |
array | List of possible warnings. |
|
static |
Returns description of method parameters.
external_function_parameters |
|
static |
Returns description of method result value.
external_multiple_structure |
|
static |
Copy files from a draft area to users private files area.
invalid_parameter_exception | |
moodle_exception |
int | $draftid | Id of a draft area containing files. |
array | An array of warnings |
|
static |
Returns description of method parameters.
external_function_parameters |
|
static |
|
static |
Agree the site policy for the current user.
array | of warnings and status result |
moodle_exception |
|
static |
Returns description of method parameters.
external_function_parameters |
|
static |
can_view_user_details_cap | ( | $user, | |
$course = null ) |
Check if $USER have the necessary capabilities to obtain user details.
stdClass | $user | |
stdClass | $course | if null then only consider system profile otherwise also consider the course's profile. |
bool | true if $USER can view user details. |
cancel_email_update | ( | $userid | ) |
Cancels the requirement for a user to update their email address.
int | $userid |
core_user_inplace_editable | ( | $itemtype, | |
$itemid, | |||
$newvalue ) |
Callback for inplace editable API.
string | $itemtype | - Only user_roles is supported. |
string | $itemid | - Courseid and userid separated by a : |
string | $newvalue | - json encoded list of roleids. |
core\output\inplace_editable|null |
|
static |
Get course participant's details.
array | $userlist | array of user ids and according course ids |
array | An array of arrays describing course participants |
|
static |
Returns description of method parameters.
external_function_parameters |
|
static |
|
static |
Returns general information about files in the user private files area.
int | $userid | Id of the user, default to current user. |
array | of warnings and file area information |
moodle_exception |
|
static |
Returns description of method parameters.
external_function_parameters |
|
static |
|
static |
Return user preferences.
string | $name | preference name, empty for all |
int | $userid | id of the user, 0 for current user |
array | of warnings and preferences |
moodle_exception |
|
static |
Returns description of method parameters.
external_function_parameters |
|
static |
|
static |
Retrieve matching user.
moodle_exception |
array | $criteria | the allowed array keys are id/lastname/firstname/idnumber/username/email/auth. |
array | An array of arrays containing user profiles. |
|
static |
Returns description of method result value.
external_multiple_structure |
|
static |
Returns description of get_users() parameters.
external_function_parameters |
|
static |
profile_delete_category | ( | $id | ) |
Delete a profile category.
int | $id | of the category to be deleted |
bool | success of operation |
profile_delete_field | ( | $id | ) |
Deletes a profile field.
int | $id |
profile_list_categories | ( | ) |
Retrieve a list of categories and ids suitable for use in a form.
array |
profile_list_datatypes | ( | ) |
Retrieve a list of all the available data types.
array | a list of the datatypes suitable to use in a select statement |
profile_move_category | ( | $id, | |
$move ) |
Change the sort order of a category.
int | $id | of the category |
string | $move | direction of move |
bool | success of operation |
profile_move_field | ( | $id, | |
$move ) |
Change the sort order of a field.
int | $id | of the field |
string | $move | direction of move |
bool | success of operation |
profile_save_category | ( | stdClass | $data | ) |
Create or update a profile category.
stdClass | $data |
profile_save_field | ( | stdClass | $data, |
array | $editors ) |
Save updated field definition or create a new field.
stdClass | $data | data from the form profile_field_form |
array | $editors | editors for this form field type |
|
static |
Remove a user device from the Moodle database (for PUSH notifications usually).
string | $uuid | The device UUID. |
string | $appid | The app id, opitonal parameter. If empty all the devices fmatching the UUID or the user will be removed. |
array | List of possible warnings and removal status. |
|
static |
Returns description of method parameters.
external_function_parameters |
|
static |
Returns description of method result value.
external_multiple_structure |
|
static |
Set user preferences.
array | $preferences | list of preferences including name, value and userid |
array | of warnings and preferences saved |
moodle_exception |
|
static |
Returns description of method parameters.
external_function_parameters |
|
static |
|
static |
Update or delete the user picture in the site.
int | $draftitemid | id of the user draft file to use as image |
bool | $delete | if we should delete the user picture |
int | $userid | id of the user, 0 for current user |
array | warnings and success status |
moodle_exception |
|
static |
Returns description of method parameters.
external_function_parameters |
|
static |
user_add_password_history | ( | int | $userid, |
# string | $password[\SensitiveParameter] ) |
Add password to the list of used hashes for this user.
This is supposed to be used from: 1/ change own password form 2/ password reset process 3/ user signup in auth plugins if password changing supported
int | $userid | user id |
string | $password | plaintext password |
void |
user_can_view_profile | ( | $user, | |
$course = null, | |||
$usercontext = null ) |
Check if the current user has permission to view details of the supplied user.
This function supports two modes: If the optional $course param is omitted, then this function finds all shared courses and checks whether the current user has permission in any of them, returning true if so. If the $course param is provided, then this function checks permissions in ONLY that course.
object | $user | The other user's details. |
object | $course | if provided, only check permissions in this course. |
context | $usercontext | The user context if available. |
bool | true for ability to view this user, else false. |
user_convert_text_to_menu_items | ( | $text, | |
$page ) |
Converts a string into a flat array of menu items, where each menu items is a stdClass with fields type, url, title.
string | $text | the menu items definition |
moodle_page | $page | the current page |
array |
user_count_login_failures | ( | $user, | |
$reset = true ) |
Count the number of failed login attempts for the given user, since last successful login.
int | stdclass | $user | user id or object. |
bool | $reset | Resets failed login count, if set to true. |
int | number of failed login attempts since the last successful login. |
user_create_user | ( | $user, | |
$updatepassword = true, | |||
$triggerevent = true ) |
Creates a user.
moodle_exception |
stdClass | array | $user | user to create |
bool | $updatepassword | if true, authentication plugin will update password. |
bool | $triggerevent | set false if user_created event should not be triggred. This will not affect user_password_updated event triggering. |
int | id of the newly created user |
user_delete_user | ( | $user | ) |
Marks user deleted in internal user database and notifies the auth plugin.
Also unenrols user from all roles and does other cleanup.
object | $user | Userobject before delete (without system magic quotes) |
boolean | success |
|
static |
Create user return value description.
array | $additionalfields | some additional field |
external_description |
user_edit_map_field_purpose | ( | $userid, | |
$fieldname ) |
Map an internal field name to a valid purpose from: "https://www.w3.org/TR/WCAG21/#input-purposes".
integer | $userid | |
string | $fieldname |
string\$purpose | (empty string if there is no mapping). |
user_get_course_lastaccess_sql | ( | $accesssince = null, | |
$tableprefix = 'ul', | |||
$haveaccessed = false ) |
Returns SQL that can be used to limit a query to a period where the user last accessed / did not access a course.
int | $accesssince | The unix timestamp to compare to users' last access |
string | $tableprefix | |
bool | $haveaccessed | Whether to match against users who HAVE accessed since $accesssince (optional) |
string |
user_get_default_fields | ( | ) |
Returns the list of default 'displayable' fields.
Contains database field names but also names used to generate information, such as enrolledcourses
array | of user fields |
user_get_lastaccess_sql | ( | $columnname, | |
$accesssince, | |||
$tableprefix, | |||
$haveaccessed = false ) |
Returns SQL that can be used to limit a query to a period where the user last accessed or did not access something recorded by a given table.
string | $columnname | The name of the access column to check against |
int | $accesssince | The unix timestamp to compare to users' last access |
string | $tableprefix | The query prefix of the table to check |
bool | $haveaccessed | Whether to match against users who HAVE accessed since $accesssince (optional) |
string |
user_get_tagged_users | ( | $tag, | |
$exclusivemode = false, | |||
$fromctx = 0, | |||
$ctx = 0, | |||
$rec = 1, | |||
$page = 0 ) |
Returns users tagged with a specified tag.
core_tag_tag | $tag | |
bool | $exclusivemode | if set to true it means that no other entities tagged with this tag are displayed on the page and the per-page limit may be bigger |
int | $fromctx | context id where the link was displayed, may be used by callbacks to display items in the same context first |
int | $ctx | context id where to search for records |
bool | $rec | search in subcontexts as well |
int | $page | 0-based number of page being displayed |
core_tag\output\tagindex |
user_get_user_details | ( | $user, | |
$course = null, | |||
array | $userfields = array() ) |
Give user record from mdl_user, build an array contains all user details.
Warning: description file urls are 'webservice/pluginfile.php' is use. it can be changed with $CFG->moodlewstextformatlinkstoimagesfile
moodle_exception |
stdClass | $user | user record from mdl_user |
stdClass | $course | moodle course |
array | $userfields | required fields |
array|null |
user_get_user_details_courses | ( | $user, | |
array | $userfields = [] ) |
Tries to obtain user details, either recurring directly to the user's system profile or through one of the user's course enrollments (course profile).
You can use the $userfields parameter to reduce the amount of a user record that is required by the method. The minimum user fields are:
stdClass | $user | The user. |
array | $userfields | An array of userfields to be returned, the values must be a subset of user_get_default_fields (optional) |
array | if unsuccessful or the allowed user details. |
user_get_user_lastaccess_sql | ( | $accesssince = null, | |
$tableprefix = 'u', | |||
$haveaccessed = false ) |
Returns SQL that can be used to limit a query to a period where the user last accessed / did not access the system.
int | $accesssince | The unix timestamp to compare to users' last access |
string | $tableprefix | |
bool | $haveaccessed | Whether to match against users who HAVE accessed since $accesssince (optional) |
string |
user_get_user_navigation_info | ( | $user, | |
$page, | |||
$options = array() ) |
Get a list of essential user navigation items.
stdclass | $user | user object. |
moodle_page | $page | page object. |
array | $options | associative array. options are:
|
stdClass\$returnobj | navigation information object, where: $returnobj->navitems array array of links where each link is a stdClass with fields url, title, and pix $returnobj->metadata array array of useful user metadata to be used when constructing navigation; fields include: ROLE FIELDS asotherrole bool whether viewing as another role rolename string name of the role USER FIELDS These fields are for the currently-logged in user, or for the user that the real user is currently logged in as. userid int the id of the user in question userfullname string the user's full name userprofileurl moodle_url the url of the user's profile useravatar string a HTML fragment - the rendered user_picture for this user userloginfail string an error string denoting the number of login failures since last login "REAL USER" FIELDS These fields are for when asotheruser is true, and correspond to the underlying "real user". asotheruser bool whether viewing as another user realuserid int the id of the user in question realuserfullname string the user's full name realuserprofileurl moodle_url the url of the user's profile realuseravatar string a HTML fragment - the rendered user_picture for this user MNET PROVIDER FIELDS asmnetuser bool whether viewing as a user from an MNet provider mnetidprovidername string name of the MNet provider mnetidproviderwwwroot string URL of the MNet provider |
user_get_users_by_id | ( | $userids | ) |
Get users by id.
array | $userids | id of users to retrieve |
array |
user_is_previously_used_password | ( | $userid, | |
$password ) |
Was this password used before on change or reset password page?
The $CFG->passwordreuselimit setting determines how many times different password needs to be used before allowing previously used password again.
int | $userid | user id |
string | $password | plaintext password |
bool | true if password reused |
user_list_view | ( | $course, | |
$context ) |
Trigger user_list_viewed event.
stdClass | $course | course object |
stdClass | $context | course context object |
user_mygrades_url | ( | $userid = null, | |
$courseid = SITEID ) |
Returns the url to use for the "Grades" link in the user navigation.
int | $userid | The user's ID. |
int | $courseid | The course ID if available. |
mixed | A URL to be directed to for "Grades". |
user_page_type_list | ( | $pagetype, | |
$parentcontext, | |||
$currentcontext ) |
Return a list of page types.
string | $pagetype | current page type |
stdClass | $parentcontext | Block's parent context |
stdClass | $currentcontext | Current context of block |
array |
user_remove_user_device | ( | $uuid, | |
$appid = "" ) |
Remove a user device from the Moodle database (for PUSH notifications usually).
string | $uuid | The device UUID. |
string | $appid | The app id. If empty all the devices matching the UUID for the user will be removed. |
bool | true if removed, false if the device didn't exists in the database |
user_update_device_public_key | ( | string | $uuid, |
string | $appid, | ||
string | $publickey ) |
Update the users public key for the specified device and app.
string | $uuid | The device UUID. |
string | $appid | The app id, usually something like com.moodle.moodlemobile. |
string | $publickey | The app generated public key. |
bool |
user_update_user | ( | $user, | |
$updatepassword = true, | |||
$triggerevent = true ) |
Update a user with a user object (will compare against the ID)
moodle_exception |
stdClass | array | $user | the user to update |
bool | $updatepassword | if true, authentication plugin will update password. |
bool | $triggerevent | set false if user_updated event should not be triggred. This will not affect user_password_updated event triggering. |
useredit_get_disabled_name_fields | ( | $enabledadditionalusernames = null | ) |
Gets user name fields not enabled from the setting fullnamedisplay.
array | $enabledadditionalusernames | Current enabled additional user name fields. |
array | Disabled user name fields. |
useredit_get_enabled_name_fields | ( | ) |
Gets enabled (from fullnameformate setting) user name fields in appropriate order.
array | Enabled user name fields. |
useredit_get_required_name_fields | ( | ) |
Return required user name fields for forms.
array | required user name fields in order according to settings. |
useredit_load_preferences | ( | & | $user, |
$reload = true ) |
Loads the given users preferences into the given user object.
stdClass | $user | The user object, modified by reference. |
bool | $reload |
useredit_setup_preference_page | ( | $userid, | |
$courseid ) |
Performs the common access checks and page setup for all user preference pages.
int | $userid | The user id to edit taken from the page params. |
int | $courseid | The optional course id if we came from a course context. |
array | containing the user and course records. |
useredit_shared_definition | ( | & | $mform, |
$editoroptions, | |||
$filemanageroptions, | |||
$user ) |
Powerful function that is used by edit and editadvanced to add common form elements/rules/etc.
MoodleQuickForm | $mform | |
array | $editoroptions | |
array | $filemanageroptions | |
stdClass | $user |
useredit_update_bounces | ( | $user, | |
$usernew ) |
Updates the user email bounce + send counts when the user is edited.
stdClass | $user | The current user object. |
stdClass | $usernew | The updated user object. |
useredit_update_interests | ( | $user, | |
$interests ) |
Updates a users interests.
stdClass | $user | |
array | $interests |
useredit_update_picture | ( | ) |
useredit_update_trackforums | ( | $user, | |
$usernew ) |
Updates the forums a user is tracking when the user is edited.
stdClass | $user | The original user object. |
stdClass | $usernew | The updated user object. |
useredit_update_user_preference | ( | $usernew | ) |
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, {
Some parts of code may use user preference table to store internal data, in these cases it is acceptable to call set_user_preference()
stdClass | array | $usernew | object or array that has user preferences as attributes with keys starting with preference_ |
|
static |
Trigger the user_list_viewed event.
int | $courseid | id of course |
array | of warnings and status result |
moodle_exception |
|
static |
Returns description of method parameters.
external_function_parameters |
|
static |
|
static |
Trigger the user profile viewed event.
int | $userid | id of user |
int | $courseid | id of course |
array | of warnings and status result |
moodle_exception |
|
static |
Returns description of method parameters.
external_function_parameters |
|
static |
const PROFILE_VISIBLE_ALL '2' |
Visible to anyone who can view the user.
Editable by the profile owner if they have the moodle/user:editownprofile capability or any user with the moodle/user:update capability.
const PROFILE_VISIBLE_NONE '0' |
Only visible to users with the moodle/user:viewalldetails capability.
Only editable by users with the moodle/user:viewalldetails and moodle/user:update capabilities.
const PROFILE_VISIBLE_PRIVATE '1' |
Visible to the profile owner or anyone with the moodle/user:viewalldetails capability.
Editable by the profile owner if they have the moodle/user:editownprofile capability or any user with moodle/user:viewalldetails and moodle/user:update capabilities.
const PROFILE_VISIBLE_TEACHERS '3' |
Visible to anyone who has the moodle/site:viewuseridentity permission.
Editable by the profile owner if they have the moodle/user:editownprofile capability or any user with the moodle/user:update capability.