Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

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

External user API

Copyright: 2009 Petr Skodak
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 2010 lines (87 kb)
Included or required:0 times
Referenced: 4 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.

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

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

param: array $userids
return: null

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.

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

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

param: array $users
return: null

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

return: null

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.

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

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.

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

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

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

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.

param: array $additionalfields some additional field
return: single_structure_description

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.

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

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).

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.
return: array List of possible warnings.

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).

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.
return: array List of possible warnings and removal status.

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.

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

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.

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

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.

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

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

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
return: array warnings and success status

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.

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

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.

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

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

return: external_description