Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
external

Namespaces

namespace  core_user\external
  
 

Classes

class  core_user\external\search_identity
 Provides the core_user_search_identity external function. More...
 
class  core_user_external
 User external functions. 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.
 
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.
 
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.
 
static user_description ($additionalfields=array())
 Create user return value description.
 
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.
 

Detailed Description

Function Documentation

◆ add_user_device()

static add_user_device ( $appid,
$name,
$model,
$platform,
$version,
$pushid,
$uuid,
$publickey = null )
static

Add a user device in Moodle database (for PUSH notifications usually).

Exceptions
moodle_exception
Parameters
string$appidThe app id, usually something like com.moodle.moodlemobile.
string$nameThe device name, occam or iPhone etc.
string$modelThe device model Nexus4 or iPad1.1 etc.
string$platformThe device platform iOs or Android etc.
string$versionThe device version 6.1.2 or 4.2.2 etc.
string$pushidThe device PUSH token/key/identifier/registration id.
string$uuidThe device UUID.
string$publickeyThe app generated public key
Return values
arrayList of possible warnings.
Since
Moodle 2.6

◆ add_user_device_parameters()

static add_user_device_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 2.6

◆ add_user_device_returns()

static add_user_device_returns ( )
static

Returns description of method result value.

Return values
external_multiple_structure
Since
Moodle 2.6

◆ add_user_private_files()

static add_user_private_files ( $draftid)
static

Copy files from a draft area to users private files area.

Exceptions
invalid_parameter_exception
moodle_exception
Parameters
int$draftidId of a draft area containing files.
Return values
arrayAn array of warnings
Since
Moodle 2.6

◆ add_user_private_files_parameters()

static add_user_private_files_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 2.6

◆ add_user_private_files_returns()

static add_user_private_files_returns ( )
static

Returns description of method result value.

Return values
external_description
Since
Moodle 2.2

◆ agree_site_policy()

static agree_site_policy ( )
static

Agree the site policy for the current user.

Return values
arrayof warnings and status result
Since
Moodle 3.2
Exceptions
moodle_exception

◆ agree_site_policy_parameters()

static agree_site_policy_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 3.2

◆ agree_site_policy_returns()

static agree_site_policy_returns ( )
static

Returns description of method result value.

Return values
external_description
Since
Moodle 3.2

◆ get_course_user_profiles()

static get_course_user_profiles ( $userlist)
static

Get course participant's details.

Parameters
array$userlistarray of user ids and according course ids
Return values
arrayAn array of arrays describing course participants
Since
Moodle 2.2

◆ get_course_user_profiles_parameters()

static get_course_user_profiles_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 2.2

◆ get_course_user_profiles_returns()

static get_course_user_profiles_returns ( )
static

Returns description of method result value.

Return values
external_description
Since
Moodle 2.2

◆ get_private_files_info()

static get_private_files_info ( $userid = 0)
static

Returns general information about files in the user private files area.

Parameters
int$useridId of the user, default to current user.
Return values
arrayof warnings and file area information
Since
Moodle 3.4
Exceptions
moodle_exception

◆ get_private_files_info_parameters()

static get_private_files_info_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 3.4

◆ get_private_files_info_returns()

static get_private_files_info_returns ( )
static

Returns description of method result value.

Return values
external_description
Since
Moodle 3.4

◆ get_user_preferences()

static get_user_preferences ( $name = '',
$userid = 0 )
static

Return user preferences.

Parameters
string$namepreference name, empty for all
int$useridid of the user, 0 for current user
Return values
arrayof warnings and preferences
Since
Moodle 3.2
Exceptions
moodle_exception

◆ get_user_preferences_parameters()

static get_user_preferences_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 3.2

◆ get_user_preferences_returns()

static get_user_preferences_returns ( )
static

Returns description of method result value.

Return values
external_description
Since
Moodle 3.2

◆ get_users()

static get_users ( $criteria = array())
static

Retrieve matching user.

Exceptions
moodle_exception
Parameters
array$criteriathe allowed array keys are id/lastname/firstname/idnumber/username/email/auth.
Return values
arrayAn array of arrays containing user profiles.
Since
Moodle 2.5

◆ get_users_by_field_returns()

static get_users_by_field_returns ( )
static

Returns description of method result value.

Return values
external_multiple_structure
Since
Moodle 2.4

◆ get_users_parameters()

static get_users_parameters ( )
static

Returns description of get_users() parameters.

Return values
external_function_parameters
Since
Moodle 2.5

◆ get_users_returns()

static get_users_returns ( )
static

Returns description of get_users result value.

Return values
external_description
Since
Moodle 2.5

◆ remove_user_device()

static remove_user_device ( $uuid,
$appid = "" )
static

Remove a user device from the Moodle database (for PUSH notifications usually).

Parameters
string$uuidThe device UUID.
string$appidThe app id, opitonal parameter. If empty all the devices fmatching the UUID or the user will be removed.
Return values
arrayList of possible warnings and removal status.
Since
Moodle 2.9

◆ remove_user_device_parameters()

static remove_user_device_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 2.9

◆ remove_user_device_returns()

static remove_user_device_returns ( )
static

Returns description of method result value.

Return values
external_multiple_structure
Since
Moodle 2.9

◆ set_user_preferences()

static set_user_preferences ( $preferences)
static

Set user preferences.

Parameters
array$preferenceslist of preferences including name, value and userid
Return values
arrayof warnings and preferences saved
Since
Moodle 3.2
Exceptions
moodle_exception

◆ set_user_preferences_parameters()

static set_user_preferences_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 3.2

◆ set_user_preferences_returns()

static set_user_preferences_returns ( )
static

Returns description of method result value.

Return values
external_description
Since
Moodle 3.2

◆ update_picture()

static update_picture ( $draftitemid,
$delete = false,
$userid = 0 )
static

Update or delete the user picture in the site.

Parameters
int$draftitemidid of the user draft file to use as image
bool$deleteif we should delete the user picture
int$useridid of the user, 0 for current user
Return values
arraywarnings and success status
Since
Moodle 3.2
Exceptions
moodle_exception

◆ update_picture_parameters()

static update_picture_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 3.2

◆ update_picture_returns()

static update_picture_returns ( )
static

Returns description of method result value.

Return values
external_description
Since
Moodle 3.2

◆ user_description()

static user_description ( $additionalfields = array())
static

Create user return value description.

Parameters
array$additionalfieldssome additional field
Return values
external_description

◆ view_user_list()

static view_user_list ( $courseid)
static

Trigger the user_list_viewed event.

Parameters
int$courseidid of course
Return values
arrayof warnings and status result
Since
Moodle 2.9
Exceptions
moodle_exception

◆ view_user_list_parameters()

static view_user_list_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 2.9

◆ view_user_list_returns()

static view_user_list_returns ( )
static

Returns description of method result value.

Return values
external_description
Since
Moodle 2.9

◆ view_user_profile()

static view_user_profile ( $userid,
$courseid = 0 )
static

Trigger the user profile viewed event.

Parameters
int$useridid of user
int$courseidid of course
Return values
arrayof warnings and status result
Since
Moodle 2.9
Exceptions
moodle_exception

◆ view_user_profile_parameters()

static view_user_profile_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 2.9

◆ view_user_profile_returns()

static view_user_profile_returns ( )
static

Returns description of method result value.

Return values
external_description
Since
Moodle 2.9