Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
|
Files | |
file | anycourses.php |
This is filter is used to see which students are enroled on any courses. | |
file | behat_user.php |
User steps definition. | |
file | calendar_form.php |
Form to edit a users preferred language. | |
file | category.php |
Defines a category in my profile page navigation. | |
file | checkbox.php |
Generic checkbox filter. | |
file | cohort.php |
Cohort filter. | |
file | course_form.php |
Form to edit a users course preferences. | |
file | courserole.php |
Course role filter. | |
file | date.php |
Date filter. | |
file | defaulthomepage_form.php |
Form to allow user to set their default home page. | |
file | definelib.php |
This file contains the profile_define_base class. | |
file | edit_form.php |
Form to edit a users profile. | |
file | editadvanced_form.php |
Form for editing a users profile. | |
file | editlib.php |
This file contains function used when editing a users profile and preferences. | |
file | editor_form.php |
Form to edit a users editor preferences. | |
file | files_form.php |
minimalistic edit form | |
file | forum_form.php |
Form to edit a users forum preferences. | |
file | globalrole.php |
Global role filter. | |
file | index_category_form.php |
This file contains the profile field category form. | |
file | index_field_form.php |
This file contains the Field Form used for profile fields. | |
file | language_form.php |
Form to edit a users preferred language. | |
file | lib.php |
This file contains the User Filter API. | |
file | lib.php |
Profile field API library file. | |
file | lib.php |
Code for ajax user selectors. | |
file | manager.php |
Defines Manager class for my profile navigation tree. | |
file | node.php |
Defines a node in my profile page navigation. | |
file | participants.php |
Contains the class used for the displaying the participants table. | |
file | participants_filter.php |
Class for rendering user filters on the course participants page. | |
file | participants_search.php |
Class used to fetch participants based on a filterset. | |
file | profilefield.php |
Profile field filter. | |
file | renderer.php |
myprofile renderer. | |
file | select.php |
Value select filter. | |
file | simpleselect.php |
Simple value select filter. | |
file | status_field.php |
Class containing the data necessary for rendering the status field in the course participants page. | |
file | text.php |
Text field filter. | |
file | tree.php |
Defines profile page navigation tree. | |
file | unified_filter.php |
Class containing the filter options data for rendering the unified filter autocomplete element for the course participants page. | |
file | user.php |
Search area for Users for whom I have authority to view profile. | |
file | user_filter_forms.php |
This file contains forms used to filter user. | |
file | user_profile_set.php |
User profile set indicator. | |
file | user_roles_editable.php |
Contains class core_user::output::user_roles_editable. | |
file | user_summary_exporter.php |
Class for exporting a user summary from an stdClass. | |
file | user_track_forums.php |
User tracks forums indicator. | |
file | yesno.php |
Yes/No (boolean) filter. | |
Namespaces | |
namespace | core_user |
| |
namespace | core_user\analytics\indicator |
| |
namespace | core_user\external |
| |
namespace | core_user\form |
| |
namespace | core_user\output |
| |
namespace | core_user\output\myprofile |
| |
namespace | core_user\privacy |
| |
namespace | core_user\search |
| |
namespace | core_user\table |
| |
Classes | |
class | behat_user |
class | category_form |
Class category_form. 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\course_form |
Class user_course_form. More... | |
class | core_user\external\user_summary_exporter |
Class for exporting a user summary from an stdClass. More... | |
class | core_user\form\calendar_form |
Class user_edit_calendar_form. More... | |
class | core_user\form\defaulthomepage_form |
Form class. More... | |
class | core_user\output\myprofile\category |
Defines a category in my profile page navigation. More... | |
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\myprofile\tree |
Defines my profile page navigation tree. 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\unified_filter |
Class containing the filter options data for rendering the unified filter autocomplete element for the course participants page. More... | |
class | core_user\output\user_roles_editable |
Class to display list of user roles. More... | |
class | core_user\privacy\provider |
Privacy class for requesting user data. 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 | field_form |
Class field_form. 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 | profile_field_base |
Base class for the customisable profile fields. 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_files_form |
Class user_files_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 | |
can_view_user_details_cap ($user, $course=null) | |
Check if $USER have the necessary capabilities to obtain user details. More... | |
cancel_email_update ($userid) | |
Cancels the requirement for a user to update their email address. More... | |
core_user_inplace_editable ($itemtype, $itemid, $newvalue) | |
Callback for inplace editable API. More... | |
profile_definition ($mform, $userid=0) | |
Print out the customisable categories and fields for a users profile. More... | |
profile_definition_after_data ($mform, $userid) | |
Adds profile fields to user edit forms. More... | |
profile_delete_category ($id) | |
Delete a profile category. More... | |
profile_delete_field ($id) | |
Deletes a profile field. More... | |
profile_display_fields ($userid) | |
Display profile fields. More... | |
profile_edit_category ($id, $redirect) | |
Edit a category. More... | |
profile_edit_field ($id, $datatype, $redirect) | |
Edit a profile field. More... | |
profile_get_custom_fields ($onlyinuserobject=false) | |
Obtains a list of all available custom profile fields, indexed by id. More... | |
profile_get_signup_fields () | |
Retrieves a list of profile fields that must be displayed in the sign-up form. More... | |
profile_get_user_fields_with_data ($userid) | |
Returns an array of all custom field records with any defined data (or empty data), for the specified user id. More... | |
profile_get_user_fields_with_data_by_category ($userid) | |
Returns an array of all custom field records with any defined data (or empty data), for the specified user id, by category. More... | |
profile_has_required_custom_fields_set ($userid) | |
Does the user have all required custom fields set? More... | |
profile_list_categories () | |
Retrieve a list of categories and ids suitable for use in a form. More... | |
profile_list_datatypes () | |
Retrieve a list of all the available data types. More... | |
profile_load_custom_fields ($user) | |
Load custom profile fields into user object. More... | |
profile_load_data ($user) | |
Loads user profile field data into the user object. More... | |
profile_move_category ($id, $move) | |
Change the sort order of a category. More... | |
profile_move_field ($id, $move) | |
Change the sort order of a field. More... | |
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_custom_fields ($userid, $profilefields) | |
Save custom profile fields for a user. More... | |
profile_save_data ($usernew) | |
Saves profile data for a user. More... | |
profile_signup_fields ($mform) | |
Adds code snippet to a moodle form object for custom profile fields that should appear on the signup page. More... | |
profile_user_record ($userid, $onlyinuserobject=true) | |
Returns an object with the custom profile fields set for the given user. More... | |
profile_validation ($usernew, $files) | |
Validates profile data. More... | |
profile_view ($user, $context, $course=null) | |
Trigger a user profile viewed event. More... | |
user_add_password_history ($userid, $password) | |
Add password to the list of used hashes for this user. More... | |
user_can_view_profile ($user, $course=null, $usercontext=null) | |
Check if the current user has permission to view details of the supplied user. More... | |
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, pix, and imgsrc. More... | |
user_count_login_failures ($user, $reset=true) | |
Count the number of failed login attempts for the given user, since last successful login. More... | |
user_create_user ($user, $updatepassword=true, $triggerevent=true) | |
Creates a user. More... | |
user_delete_user ($user) | |
Marks user deleted in internal user database and notifies the auth plugin. More... | |
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". More... | |
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. More... | |
user_get_default_fields () | |
Returns the list of default 'displayable' fields. More... | |
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. More... | |
user_get_tagged_users ($tag, $exclusivemode=false, $fromctx=0, $ctx=0, $rec=1, $page=0) | |
Returns users tagged with a specified tag. More... | |
user_get_user_details ($user, $course=null, array $userfields=array()) | |
Give user record from mdl_user, build an array contains all user details. More... | |
user_get_user_details_courses ($user) | |
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). More... | |
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. More... | |
user_get_user_navigation_info ($user, $page, $options=array()) | |
Get a list of essential user navigation items. More... | |
user_get_users_by_id ($userids) | |
Get users by id. More... | |
user_is_previously_used_password ($userid, $password) | |
Was this password used before on change or reset password page? More... | |
user_list_view ($course, $context) | |
Trigger user_list_viewed event. More... | |
user_mygrades_url ($userid=null, $courseid=SITEID) | |
Returns the url to use for the "Grades" link in the user navigation. More... | |
user_page_type_list ($pagetype, $parentcontext, $currentcontext) | |
Return a list of page types. More... | |
user_remove_user_device ($uuid, $appid="") | |
Remove a user device from the Moodle database (for PUSH notifications usually). More... | |
user_update_user ($user, $updatepassword=true, $triggerevent=true) | |
Update a user with a user object (will compare against the ID) More... | |
useredit_get_disabled_name_fields ($enabledadditionalusernames=null) | |
Gets user name fields not enabled from the setting fullnamedisplay. More... | |
useredit_get_enabled_name_fields () | |
Gets enabled (from fullnameformate setting) user name fields in appropriate order. More... | |
useredit_get_required_name_fields () | |
Return required user name fields for forms. More... | |
useredit_load_preferences (&$user, $reload=true) | |
Loads the given users preferences into the given user object. More... | |
useredit_setup_preference_page ($userid, $courseid) | |
Performs the common access checks and page setup for all user preference pages. More... | |
useredit_shared_definition (&$mform, $editoroptions, $filemanageroptions, $user) | |
Powerful function that is used by edit and editadvanced to add common form elements/rules/etc. More... | |
useredit_update_bounces ($user, $usernew) | |
Updates the user email bounce + send counts when the user is edited. More... | |
useredit_update_interests ($user, $interests) | |
Updates a users interests. More... | |
useredit_update_picture () | |
useredit_update_trackforums ($user, $usernew) | |
Updates the forums a user is tracking when the user is edited. More... | |
useredit_update_user_preference ($usernew) | |
Updates the user preferences for the given user. More... | |
Variables | |
global | core_user\table::$CFG |
core_user::if (!defined( 'MOODLE_INTERNAL')) | |
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')) | |
if (!defined( 'MOODLE_INTERNAL')) | |
if (!defined( 'MOODLE_INTERNAL')) | |
const | PROFILE_VISIBLE_ALL '2' |
Visible to anyone who can view the user. More... | |
const | PROFILE_VISIBLE_NONE '0' |
Only visible to users with the moodle/user:viewalldetails capability. More... | |
const | PROFILE_VISIBLE_PRIVATE '1' |
Visible to the profile owner or anyone with the moodle/user:viewalldetails capability. More... | |
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. | |
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 |
profile_definition | ( | $mform, | |
$userid = 0 |
|||
) |
Print out the customisable categories and fields for a users profile.
moodleform | $mform | instance of the moodleform class |
int | $userid | id of user whose profile is being edited. |
profile_definition_after_data | ( | $mform, | |
$userid | |||
) |
Adds profile fields to user edit forms.
moodleform | $mform | |
int | $userid |
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_display_fields | ( | $userid | ) |
Display profile fields.
int | $userid |
profile_edit_category | ( | $id, | |
$redirect | |||
) |
Edit a category.
int | $id | |
string | $redirect |
profile_edit_field | ( | $id, | |
$datatype, | |||
$redirect | |||
) |
Edit a profile field.
int | $id | |
string | $datatype | |
string | $redirect |
profile_get_custom_fields | ( | $onlyinuserobject = false | ) |
Obtains a list of all available custom profile fields, indexed by id.
Some profile fields are not included in the user object data (see profile_user_record function above). Optionally, you can obtain only those fields that are included in the user object.
To be clear, this function returns the available fields, and does not return the field values for a particular user.
bool | $onlyinuserobject | True if you only want the ones in $USER |
array | Array of field objects from database (indexed by id) |
profile_get_signup_fields | ( | ) |
Retrieves a list of profile fields that must be displayed in the sign-up form.
array | list of profile fields info |
profile_get_user_fields_with_data | ( | $userid | ) |
Returns an array of all custom field records with any defined data (or empty data), for the specified user id.
int | $userid |
profile_field_base[] |
profile_get_user_fields_with_data_by_category | ( | $userid | ) |
Returns an array of all custom field records with any defined data (or empty data), for the specified user id, by category.
int | $userid |
profile_field_base[][] |
profile_has_required_custom_fields_set | ( | $userid | ) |
Does the user have all required custom fields set?
Internal, to be exclusively used by user_not_fully_set_up() only.
Note that if users have no way to fill a required field via editing their profiles (e.g. the field is not visible or it is locked), we still return true. So this is actually checking if we should redirect the user to edit their profile, rather than whether there is a value in the database.
int | $userid |
bool |
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_load_custom_fields | ( | $user | ) |
Load custom profile fields into user object.
stdClass | $user | user object |
profile_load_data | ( | $user | ) |
Loads user profile field data into the user object.
stdClass | $user |
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_custom_fields | ( | $userid, | |
$profilefields | |||
) |
Save custom profile fields for a user.
int | $userid | The user id |
array | $profilefields | The fields to save |
profile_save_data | ( | $usernew | ) |
Saves profile data for a user.
stdClass | $usernew |
profile_signup_fields | ( | $mform | ) |
Adds code snippet to a moodle form object for custom profile fields that should appear on the signup page.
moodleform | $mform | moodle form object |
profile_user_record | ( | $userid, | |
$onlyinuserobject = true |
|||
) |
Returns an object with the custom profile fields set for the given user.
integer | $userid | |
bool | $onlyinuserobject | True if you only want the ones in $USER. |
stdClass |
profile_validation | ( | $usernew, | |
$files | |||
) |
Validates profile data.
stdClass | $usernew | |
array | $files |
array |
profile_view | ( | $user, | |
$context, | |||
$course = null |
|||
) |
Trigger a user profile viewed event.
stdClass | $user | user object |
stdClass | $context | context object (course or user) |
stdClass | $course | course object |
user_add_password_history | ( | $userid, | |
$password | |||
) |
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, pix, and imgsrc.
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 | $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 |
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 | ) |
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).
stdClass | $user | The user. |
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_user | ( | $user, | |
$updatepassword = true , |
|||
$triggerevent = true |
|||
) |
Update a user with a user object (will compare against the ID)
moodle_exception |
stdClass | $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.
moodleform | $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 whitelist 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_ |
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.