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.

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]

External user API

Copyright: 2009 Petr Skodak
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 2053 lines (88 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 2 classes

core_user_external:: (22 methods):
  create_users_parameters()
  create_users()
  create_users_returns()
  delete_users_parameters()
  delete_users()
  delete_users_returns()
  update_user_preferences_parameters()
  update_user_preferences()
  update_user_preferences_returns()
  update_users_parameters()
  update_users()
  update_users_returns()
  get_users_by_field_parameters()
  get_users_by_field()
  get_users_by_field_returns()
  get_users_parameters()
  get_users()
  get_users_returns()
  get_course_user_profiles_parameters()
  get_course_user_profiles()
  get_course_user_profiles_returns()
  user_description()

in:: (30 methods):
  add_user_private_files_parameters()
  add_user_private_files()
  add_user_private_files_returns()
  add_user_device_parameters()
  add_user_device()
  add_user_device_returns()
  remove_user_device_parameters()
  remove_user_device()
  remove_user_device_returns()
  view_user_list_parameters()
  view_user_list()
  view_user_list_returns()
  view_user_profile_parameters()
  view_user_profile()
  view_user_profile_returns()
  get_user_preferences_parameters()
  get_user_preferences()
  get_user_preferences_returns()
  update_picture_parameters()
  update_picture()
  update_picture_returns()
  set_user_preferences_parameters()
  set_user_preferences()
  set_user_preferences_returns()
  agree_site_policy_parameters()
  agree_site_policy()
  agree_site_policy_returns()
  get_private_files_info_parameters()
  get_private_files_info()
  get_private_files_info_returns()


Class: core_user_external  - X-Ref

User external functions

create_users_parameters()   X-Ref
Returns description of method parameters

return: external_function_parameters

create_users($users)   X-Ref
Create one or more users.

return: array An array of arrays
param: array $users An array of users to create.

create_users_returns()   X-Ref
Returns description of method result value

return: external_description

delete_users_parameters()   X-Ref
Returns description of method parameters

return: external_function_parameters

delete_users($userids)   X-Ref
Delete users

return: null
param: array $userids

delete_users_returns()   X-Ref
Returns description of method result value

return: null

update_user_preferences_parameters()   X-Ref
Returns description of method parameters.

return: external_function_parameters

update_user_preferences($userid = 0, $emailstop = null, $preferences = array()   X-Ref
Update the user's preferences.

return: null
param: int $userid
param: bool|null $emailstop
param: array $preferences

update_user_preferences_returns()   X-Ref
Returns description of method result value

return: null

update_users_parameters()   X-Ref
Returns description of method parameters

return: external_function_parameters

update_users($users)   X-Ref
Update users

return: null
param: array $users

update_users_returns()   X-Ref
Returns description of method result value

return: external_description

get_users_by_field_parameters()   X-Ref
Returns description of method parameters

return: external_function_parameters

get_users_by_field($field, $values)   X-Ref
Get user information for a unique field.

return: array An array of arrays containg user profiles.
param: string $field
param: array $values

get_users_by_field_returns()   X-Ref
Returns description of method result value

return: external_multiple_structure

get_users_parameters()   X-Ref
Returns description of get_users() parameters.

return: external_function_parameters

get_users($criteria = array()   X-Ref
Retrieve matching user.

return: array An array of arrays containing user profiles.
param: array $criteria the allowed array keys are id/lastname/firstname/idnumber/username/email/auth.

get_users_returns()   X-Ref
Returns description of get_users result value.

return: external_description

get_course_user_profiles_parameters()   X-Ref
Returns description of method parameters

return: external_function_parameters

get_course_user_profiles($userlist)   X-Ref
Get course participant's details

return: array An array of arrays describing course participants
param: array $userlist  array of user ids and according course ids

get_course_user_profiles_returns()   X-Ref
Returns description of method result value

return: external_description

user_description($additionalfields = array()   X-Ref
Create user return value description.

return: single_structure_description
param: array $additionalfields some additional field

Class: in  - X-Ref

add_user_private_files_parameters()   X-Ref
Returns description of method parameters

return: external_function_parameters

add_user_private_files($draftid)   X-Ref
Copy files from a draft area to users private files area.

return: array An array of warnings
param: int $draftid Id of a draft area containing files.

add_user_private_files_returns()   X-Ref
Returns description of method result value

return: external_description

add_user_device_parameters()   X-Ref
Returns description of method parameters.

return: external_function_parameters

add_user_device($appid, $name, $model, $platform, $version, $pushid, $uuid)   X-Ref
Add a user device in Moodle database (for PUSH notifications usually).

return: array List of possible warnings.
param: string $appid The app id, usually something like com.moodle.moodlemobile.
param: string $name The device name, occam or iPhone etc.
param: string $model The device model Nexus4 or iPad1.1 etc.
param: string $platform The device platform iOs or Android etc.
param: string $version The device version 6.1.2 or 4.2.2 etc.
param: string $pushid The device PUSH token/key/identifier/registration id.
param: string $uuid The device UUID.

add_user_device_returns()   X-Ref
Returns description of method result value.

return: external_multiple_structure

remove_user_device_parameters()   X-Ref
Returns description of method parameters.

return: external_function_parameters

remove_user_device($uuid, $appid = "")   X-Ref
Remove a user device from the Moodle database (for PUSH notifications usually).

return: array List of possible warnings and removal status.
param: string $uuid The device UUID.
param: string $appid The app id, opitonal parameter. If empty all the devices fmatching the UUID or the user will be removed.

remove_user_device_returns()   X-Ref
Returns description of method result value.

return: external_multiple_structure

view_user_list_parameters()   X-Ref
Returns description of method parameters

return: external_function_parameters

view_user_list($courseid)   X-Ref
Trigger the user_list_viewed event.

return: array of warnings and status result
param: int $courseid id of course

view_user_list_returns()   X-Ref
Returns description of method result value

return: external_description

view_user_profile_parameters()   X-Ref
Returns description of method parameters

return: external_function_parameters

view_user_profile($userid, $courseid = 0)   X-Ref
Trigger the user profile viewed event.

return: array of warnings and status result
param: int $userid id of user
param: int $courseid id of course

view_user_profile_returns()   X-Ref
Returns description of method result value

return: external_description

get_user_preferences_parameters()   X-Ref
Returns description of method parameters

return: external_function_parameters

get_user_preferences($name = '', $userid = 0)   X-Ref
Return user preferences.

return: array of warnings and preferences
param: string $name preference name, empty for all
param: int $userid id of the user, 0 for current user

get_user_preferences_returns()   X-Ref
Returns description of method result value

return: external_description

update_picture_parameters()   X-Ref
Returns description of method parameters

return: external_function_parameters

update_picture($draftitemid, $delete = false, $userid = 0)   X-Ref
Update or delete the user picture in the site

return: array warnings and success status
param: int  $draftitemid id of the user draft file to use as image
param: bool $delete      if we should delete the user picture
param: int $userid       id of the user, 0 for current user

update_picture_returns()   X-Ref
Returns description of method result value

return: external_description

set_user_preferences_parameters()   X-Ref
Returns description of method parameters

return: external_function_parameters

set_user_preferences($preferences)   X-Ref
Set user preferences.

return: array of warnings and preferences saved
param: array $preferences list of preferences including name, value and userid

set_user_preferences_returns()   X-Ref
Returns description of method result value

return: external_description

agree_site_policy_parameters()   X-Ref
Returns description of method parameters.

return: external_function_parameters

agree_site_policy()   X-Ref
Agree the site policy for the current user.

return: array of warnings and status result

agree_site_policy_returns()   X-Ref
Returns description of method result value.

return: external_description

get_private_files_info_parameters()   X-Ref
Returns description of method parameters.

return: external_function_parameters

get_private_files_info($userid = 0)   X-Ref
Returns general information about files in the user private files area.

return: array of warnings and file area information
param: int $userid Id of the user, default to current user.

get_private_files_info_returns()   X-Ref
Returns description of method result value.

return: external_description