Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
core_message_external Class Reference

Message external functions. More...

Inheritance diagram for core_message_external:

Static Public Member Functions

static block_user (int $userid, int $blockeduserid)
 Blocks a user.
 
static block_user_parameters ()
 Block user parameters description.
 
static block_user_returns ()
 Block user return description.
 
static confirm_contact_request (int $userid, int $requesteduserid)
 Confirm a contact request.
 
static confirm_contact_request_parameters ()
 Confirm a contact request parameters description.
 
static confirm_contact_request_returns ()
 Confirm a contact request return description.
 
static create_contact_request (int $userid, int $requesteduserid)
 Creates a contact request.
 
static create_contact_request_parameters ()
 Creates a contact request parameters description.
 
static create_contact_request_returns ()
 Creates a contact request return description.
 
static data_for_messagearea_search_messages ($userid, $search, $limitfrom=0, $limitnum=0)
 Get messagearea search messages results.
 
static data_for_messagearea_search_messages_parameters ()
 Get messagearea search messages parameters.
 
static data_for_messagearea_search_messages_returns ()
 Get messagearea search messages returns.
 
static decline_contact_request (int $userid, int $requesteduserid)
 Declines a contact request.
 
static decline_contact_request_parameters ()
 Declines a contact request parameters description.
 
static decline_contact_request_returns ()
 Declines a contact request return description.
 
static delete_contacts ($userids, $userid=0)
 Delete contacts.
 
static delete_contacts_parameters ()
 Delete contacts parameters description.
 
static delete_contacts_returns ()
 Delete contacts return description.
 
static delete_conversations_by_id ($userid, array $conversationids)
 Deletes a conversation.
 
static delete_conversations_by_id_parameters ()
 Returns description of method parameters.
 
static delete_conversations_by_id_returns ()
 Returns description of method result value.
 
static delete_message ($messageid, $userid, $read=true)
 Deletes a message.
 
static delete_message_for_all_users (int $messageid, int $userid)
 Deletes a message for all users.
 
static delete_message_for_all_users_parameters ()
 Returns description of method parameters.
 
static delete_message_for_all_users_returns ()
 Returns description of method result value.
 
static delete_message_parameters ()
 Returns description of method parameters.
 
static delete_message_returns ()
 Returns description of method result value.
 
static get_blocked_users ($userid)
 Retrieve a list of users blocked.
 
static get_blocked_users_parameters ()
 Get blocked users parameters description.
 
static get_blocked_users_returns ()
 Get blocked users return description.
 
static get_contact_requests (int $userid, int $limitfrom=0, int $limitnum=0)
 Handles returning the contact requests for a user.
 
static get_contact_requests_parameters ()
 Returns contact requests parameters description.
 
static get_contact_requests_returns ()
 Returns the contact requests return description.
 
static get_conversation (int $userid, int $conversationid, bool $includecontactrequests=false, bool $includeprivacyinfo=false, int $memberlimit=0, int $memberoffset=0, int $messagelimit=0, int $messageoffset=0, bool $newestmessagesfirst=true)
 Get a single conversation.
 
static get_conversation_between_users (int $userid, int $otheruserid, bool $includecontactrequests=false, bool $includeprivacyinfo=false, int $memberlimit=0, int $memberoffset=0, int $messagelimit=0, int $messageoffset=0, bool $newestmessagesfirst=true)
 Get a single conversation between users.
 
static get_conversation_between_users_parameters ()
 Get conversation parameters.
 
static get_conversation_between_users_returns ()
 Get conversation returns.
 
static get_conversation_counts (int $userid)
 Returns an array of conversation counts for the various types of conversations, including favourites.
 
static get_conversation_counts_parameters ()
 Returns description of method parameters for get_conversation_counts() method.
 
static get_conversation_counts_returns ()
 Get conversation counts return description.
 
static get_conversation_members (int $userid, int $conversationid, bool $includecontactrequests=false, bool $includeprivacyinfo=false, int $limitfrom=0, int $limitnum=0)
 Returns a list of conversation members.
 
static get_conversation_members_parameters ()
 Returns get conversation members parameters description.
 
static get_conversation_members_returns ()
 Returns the get conversation members return description.
 
static get_conversation_messages (int $currentuserid, int $convid, int $limitfrom=0, int $limitnum=0, bool $newest=false, int $timefrom=0)
 Get conversation messages.
 
static get_conversation_messages_parameters ()
 The conversation messages parameters.
 
static get_conversation_messages_returns ()
 The messagearea messages return structure.
 
static get_conversation_parameters ()
 Get conversation parameters.
 
static get_conversation_returns ()
 Get conversation returns.
 
static get_conversations ($userid, $limitfrom=0, $limitnum=0, int $type=null, bool $favourites=null, bool $mergeself=false)
 Get the list of conversations for the user.
 
static get_conversations_parameters ()
 Get conversations parameters.
 
static get_conversations_returns ()
 Get conversations returns.
 
static get_member_info (int $referenceuserid, array $userids, bool $includecontactrequests=false, bool $includeprivacyinfo=false)
 Returns conversation member info for the supplied users, relative to the supplied referenceuserid.
 
static get_member_info_parameters ()
 Returns description of method parameters for get_member_info() method.
 
static get_member_info_returns ()
 Get member info return description.
 
static get_message_processor ($userid, $name)
 Get a message processor.
 
static get_message_processor_parameters ()
 Returns description of method parameters.
 
static get_message_processor_returns ()
 Returns description of method result value.
 
static get_messages ($useridto, $useridfrom=0, $type='both', $read=MESSAGE_GET_READ, $newestfirst=true, $limitfrom=0, $limitnum=0)
 Get messages function implementation.
 
static get_messages_parameters ()
 Get messages parameters description.
 
static get_messages_returns ()
 Get messages return description.
 
static get_received_contact_requests_count (int $userid)
 Returns the number of contact requests the user has received.
 
static get_received_contact_requests_count_parameters ()
 Returns the number of contact requests the user has received parameters description.
 
static get_received_contact_requests_count_returns ()
 Returns the number of contact requests the user has received return description.
 
static get_self_conversation (int $userid, int $messagelimit=0, int $messageoffset=0, bool $newestmessagesfirst=true)
 Get a single self-conversation.
 
static get_self_conversation_parameters ()
 Get self-conversation parameters.
 
static get_self_conversation_returns ()
 Get conversation returns.
 
static get_unread_conversation_counts (int $userid)
 Returns an array of unread conversation counts for the various types of conversations, including favourites.
 
static get_unread_conversation_counts_parameters ()
 Returns description of method parameters for get_unread_conversation_counts() method.
 
static get_unread_conversation_counts_returns ()
 Get unread conversation counts return description.
 
static get_unread_conversations_count ($useridto)
 Get unread messages count function.
 
static get_unread_conversations_count_parameters ()
 Get unread conversations count parameters description.
 
static get_unread_conversations_count_returns ()
 Get unread conversations count return description.
 
static get_user_contacts (int $userid, int $limitfrom=0, int $limitnum=0)
 Get user contacts.
 
static get_user_contacts_parameters ()
 The user contacts return parameters.
 
static get_user_contacts_returns ()
 The user contacts return structure.
 
static get_user_message_preferences ($userid=0)
 Get the notification preferences for a given user.
 
static get_user_message_preferences_parameters ()
 Returns description of method parameters.
 
static get_user_message_preferences_returns ()
 Returns description of method result value.
 
static get_user_notification_preferences ($userid=0)
 Get the notification preferences for a given user.
 
static get_user_notification_preferences_parameters ()
 Returns description of method parameters.
 
static get_user_notification_preferences_returns ()
 Returns description of method result value.
 
static mark_all_conversation_messages_as_read (int $userid, int $conversationid)
 Mark all conversation messages as read function.
 
static mark_all_conversation_messages_as_read_parameters ()
 Mark all conversation messages as read parameters description.
 
static mark_all_conversation_messages_as_read_returns ()
 Mark all conversation messages as read return description.
 
static mark_all_notifications_as_read ($useridto, $useridfrom, $timecreatedto=0)
 Mark all notifications as read function.
 
static mark_all_notifications_as_read_parameters ()
 Mark all notifications as read parameters description.
 
static mark_all_notifications_as_read_returns ()
 Mark all notifications as read return description.
 
static mark_message_read ($messageid, $timeread)
 Mark a single message as read, trigger message_viewed event.
 
static mark_message_read_parameters ()
 Returns description of method parameters.
 
static mark_message_read_returns ()
 Returns description of method result value.
 
static mark_notification_read ($notificationid, $timeread)
 Mark a single notification as read.
 
static mark_notification_read_parameters ()
 Returns description of method parameters.
 
static mark_notification_read_returns ()
 Returns description of method result value.
 
static message_processor_config_form ($userid, $name, $formvalues)
 Processes a message processor config form.
 
static message_processor_config_form_parameters ()
 Returns description of method parameters.
 
static message_processor_config_form_returns ()
 Returns description of method result value.
 
static message_search_users ($userid, $search, $limitfrom=0, $limitnum=0)
 Get search users results.
 
static message_search_users_parameters ()
 Get messagearea message search users parameters.
 
static message_search_users_returns ()
 Get messagearea message search users returns.
 
static mute_conversations (int $userid, array $conversationids)
 Mutes conversations.
 
static mute_conversations_parameters ()
 Mute conversations parameters description.
 
static mute_conversations_returns ()
 Mute conversations return description.
 
static search_contacts ($searchtext, $onlymycourses=false)
 Search contacts.
 
static search_contacts_parameters ()
 Search contacts parameters description.
 
static search_contacts_returns ()
 Search contacts return description.
 
static send_instant_messages ($messages=array())
 Send private messages from the current USER to other users.
 
static send_instant_messages_parameters ()
 Returns description of method parameters.
 
static send_instant_messages_returns ()
 Returns description of method result value.
 
static send_messages_to_conversation (int $conversationid, array $messages=[])
 Send messages from the current USER to a conversation.
 
static send_messages_to_conversation_parameters ()
 Returns description of method parameters.
 
static send_messages_to_conversation_returns ()
 Returns description of method result value.
 
static set_favourite_conversations (int $userid, array $conversationids)
 Favourite a conversation, or list of conversations for a user.
 
static set_favourite_conversations_parameters ()
 Returns description of method parameters for the favourite_conversations() method.
 
static set_favourite_conversations_returns ()
 Return a description of the returns for the create_user_favourite_conversations() method.
 
static unblock_user (int $userid, int $unblockeduserid)
 Unblock user.
 
static unblock_user_parameters ()
 Unblock user parameters description.
 
static unblock_user_returns ()
 Unblock user return description.
 
static unmute_conversations (int $userid, array $conversationids)
 Unmute conversations.
 
static unmute_conversations_parameters ()
 Unmute conversations parameters description.
 
static unmute_conversations_returns ()
 Unmute conversations return description.
 
static unset_favourite_conversations (int $userid, array $conversationids)
 Unfavourite a conversation, or list of conversations for a user.
 
static unset_favourite_conversations_parameters ()
 Returns description of method parameters for unfavourite_conversations() method.
 
static unset_favourite_conversations_returns ()
 Unset favourite conversations return description.
 

Static Protected Member Functions

static get_preferences_structure ()
 Returns a notification or message preference structure.
 
static validate_preferences_permissions ($userid)
 Check that the user has enough permission to retrieve message or notifications preferences.
 

Detailed Description

Message external functions.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
Since
Moodle 2.2

Member Function Documentation

◆ block_user()

static core_message_external::block_user ( int $userid,
int $blockeduserid )
static

Blocks a user.

Parameters
int$useridThe id of the user who is blocking
int$blockeduseridThe id of the user being blocked
Return values
core_external\external_description

◆ block_user_parameters()

static core_message_external::block_user_parameters ( )
static

Block user parameters description.

Return values
external_function_parameters

◆ block_user_returns()

static core_message_external::block_user_returns ( )
static

Block user return description.

Return values
core_external\external_description

◆ confirm_contact_request()

static core_message_external::confirm_contact_request ( int $userid,
int $requesteduserid )
static

Confirm a contact request.

Parameters
int$useridThe id of the user who is creating the contact request
int$requesteduseridThe id of the user being requested

◆ confirm_contact_request_parameters()

static core_message_external::confirm_contact_request_parameters ( )
static

Confirm a contact request parameters description.

Return values
external_function_parameters

◆ confirm_contact_request_returns()

static core_message_external::confirm_contact_request_returns ( )
static

Confirm a contact request return description.

Return values
core_external\external_description

◆ create_contact_request()

static core_message_external::create_contact_request ( int $userid,
int $requesteduserid )
static

Creates a contact request.

Parameters
int$useridThe id of the user who is creating the contact request
int$requesteduseridThe id of the user being requested

◆ create_contact_request_parameters()

static core_message_external::create_contact_request_parameters ( )
static

Creates a contact request parameters description.

Return values
external_function_parameters

◆ create_contact_request_returns()

static core_message_external::create_contact_request_returns ( )
static

Creates a contact request return description.

Return values
core_external\external_description

◆ data_for_messagearea_search_messages()

static core_message_external::data_for_messagearea_search_messages ( $userid,
$search,
$limitfrom = 0,
$limitnum = 0 )
static

Get messagearea search messages results.

Parameters
int$useridThe id of the user who is performing the search
string$searchThe string being searched
int$limitfrom
int$limitnum
Return values
stdClass
Exceptions
moodle_exception
Since
3.2

◆ data_for_messagearea_search_messages_parameters()

static core_message_external::data_for_messagearea_search_messages_parameters ( )
static

Get messagearea search messages parameters.

Return values
external_function_parameters
Since
3.2

◆ data_for_messagearea_search_messages_returns()

static core_message_external::data_for_messagearea_search_messages_returns ( )
static

Get messagearea search messages returns.

Return values
external_single_structure
Since
3.2

◆ decline_contact_request()

static core_message_external::decline_contact_request ( int $userid,
int $requesteduserid )
static

Declines a contact request.

Parameters
int$useridThe id of the user who is creating the contact request
int$requesteduseridThe id of the user being requested

◆ decline_contact_request_parameters()

static core_message_external::decline_contact_request_parameters ( )
static

Declines a contact request parameters description.

Return values
external_function_parameters

◆ decline_contact_request_returns()

static core_message_external::decline_contact_request_returns ( )
static

Declines a contact request return description.

Return values
core_external\external_description

◆ delete_contacts()

static core_message_external::delete_contacts ( $userids,
$userid = 0 )
static

Delete contacts.

Parameters
array$useridsarray of user IDs.
int$useridThe id of the user we are deleting the contacts for
Return values
null
Since
Moodle 2.5

◆ delete_contacts_parameters()

static core_message_external::delete_contacts_parameters ( )
static

Delete contacts parameters description.

Return values
external_function_parameters
Since
Moodle 2.5

◆ delete_contacts_returns()

static core_message_external::delete_contacts_returns ( )
static

Delete contacts return description.

Return values
core_external\external_description
Since
Moodle 2.5

◆ delete_conversations_by_id()

static core_message_external::delete_conversations_by_id ( $userid,
array $conversationids )
static

Deletes a conversation.

Parameters
int$useridThe user id of who we want to delete the conversation for
int[]$conversationidsThe ids of the conversations
Return values
array
Exceptions
moodle_exception
Since
3.6

◆ delete_conversations_by_id_parameters()

static core_message_external::delete_conversations_by_id_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
3.6

◆ delete_conversations_by_id_returns()

static core_message_external::delete_conversations_by_id_returns ( )
static

Returns description of method result value.

Return values
core_external\external_description
Since
3.6

◆ delete_message()

static core_message_external::delete_message ( $messageid,
$userid,
$read = true )
static

Deletes a message.

Parameters
int$messageidthe message id
int$useridthe user id of who we want to delete the message for
bool$readif is a message read (default to true)
Return values
core_external\external_description
Exceptions
moodle_exception
Since
3.1

◆ delete_message_for_all_users()

static core_message_external::delete_message_for_all_users ( int $messageid,
int $userid )
static

Deletes a message for all users.

Parameters
int$messageidthe message id
int$useridthe user id of who we want to delete the message for all users, is no longer used.
Return values
core_external\external_description
Exceptions
moodle_exception
Since
3.7

◆ delete_message_for_all_users_parameters()

static core_message_external::delete_message_for_all_users_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
3.7

◆ delete_message_for_all_users_returns()

static core_message_external::delete_message_for_all_users_returns ( )
static

Returns description of method result value.

Return values
core_external\external_description
Since
3.7

◆ delete_message_parameters()

static core_message_external::delete_message_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
3.1

◆ delete_message_returns()

static core_message_external::delete_message_returns ( )
static

Returns description of method result value.

Return values
core_external\external_description
Since
3.1

◆ get_blocked_users()

static core_message_external::get_blocked_users ( $userid)
static

Retrieve a list of users blocked.

Parameters
int$useridthe user whose blocked users we want to retrieve
Return values
core_external\external_description
Since
2.9

◆ get_blocked_users_parameters()

static core_message_external::get_blocked_users_parameters ( )
static

Get blocked users parameters description.

Return values
external_function_parameters
Since
2.9

◆ get_blocked_users_returns()

static core_message_external::get_blocked_users_returns ( )
static

Get blocked users return description.

Return values
external_single_structure
Since
2.9

◆ get_contact_requests()

static core_message_external::get_contact_requests ( int $userid,
int $limitfrom = 0,
int $limitnum = 0 )
static

Handles returning the contact requests for a user.

This also includes the user data necessary to display information about the user.

It will not include blocked users.

Parameters
int$useridThe id of the user we want to get the contact requests for
int$limitfrom
int$limitnum

◆ get_contact_requests_parameters()

static core_message_external::get_contact_requests_parameters ( )
static

Returns contact requests parameters description.

Return values
external_function_parameters

◆ get_contact_requests_returns()

static core_message_external::get_contact_requests_returns ( )
static

Returns the contact requests return description.

Return values
core_external\external_description

◆ get_conversation()

static core_message_external::get_conversation ( int $userid,
int $conversationid,
bool $includecontactrequests = false,
bool $includeprivacyinfo = false,
int $memberlimit = 0,
int $memberoffset = 0,
int $messagelimit = 0,
int $messageoffset = 0,
bool $newestmessagesfirst = true )
static

Get a single conversation.

Parameters
int$useridThe user id to get the conversation for
int$conversationidThe id of the conversation to fetch
bool$includecontactrequestsShould contact requests be included between members
bool$includeprivacyinfoShould privacy info be included between members
int$memberlimitLimit number of members to load
int$memberoffsetOffset members by this amount
int$messagelimitLimit number of messages to load
int$messageoffsetOffset the messages
bool$newestmessagesfirstOrder messages by newest first
Return values
stdClass
Exceptions
moodle_exceptionif the messaging feature is disabled on the site.

◆ get_conversation_between_users()

static core_message_external::get_conversation_between_users ( int $userid,
int $otheruserid,
bool $includecontactrequests = false,
bool $includeprivacyinfo = false,
int $memberlimit = 0,
int $memberoffset = 0,
int $messagelimit = 0,
int $messageoffset = 0,
bool $newestmessagesfirst = true )
static

Get a single conversation between users.

Parameters
int$useridThe user id to get the conversation for
int$otheruseridThe other user id
bool$includecontactrequestsShould contact requests be included between members
bool$includeprivacyinfoShould privacy info be included between members
int$memberlimitLimit number of members to load
int$memberoffsetOffset members by this amount
int$messagelimitLimit number of messages to load
int$messageoffsetOffset the messages
bool$newestmessagesfirstOrder messages by newest first
Return values
stdClass
Exceptions
moodle_exceptionif the messaging feature is disabled on the site.

◆ get_conversation_between_users_parameters()

static core_message_external::get_conversation_between_users_parameters ( )
static

Get conversation parameters.

Return values
external_function_parameters

◆ get_conversation_between_users_returns()

static core_message_external::get_conversation_between_users_returns ( )
static

Get conversation returns.

Return values
external_single_structure

◆ get_conversation_counts()

static core_message_external::get_conversation_counts ( int $userid)
static

Returns an array of conversation counts for the various types of conversations, including favourites.

Return format: [ 'favourites' => 0, 'types' => [ core_message\api\MESSAGE_CONVERSATION_TYPE_INDIVIDUAL => 0, core_message\api\MESSAGE_CONVERSATION_TYPE_GROUP => 0 ] ]

Parameters
int$useridthe id of the user whose counts we are fetching.
Return values
arraythe array of conversation counts, indexed by type.
Exceptions
moodle_exceptionif the current user cannot perform this action.

◆ get_conversation_counts_parameters()

static core_message_external::get_conversation_counts_parameters ( )
static

Returns description of method parameters for get_conversation_counts() method.

Return values
external_function_parameters

◆ get_conversation_counts_returns()

static core_message_external::get_conversation_counts_returns ( )
static

Get conversation counts return description.

Return values
core_external\external_description

◆ get_conversation_members()

static core_message_external::get_conversation_members ( int $userid,
int $conversationid,
bool $includecontactrequests = false,
bool $includeprivacyinfo = false,
int $limitfrom = 0,
int $limitnum = 0 )
static

Returns a list of conversation members.

Parameters
int$useridThe user we are returning the conversation members for, used by helper\get_member_info.
int$conversationidThe id of the conversation
bool$includecontactrequestsDo we want to include contact requests with this data?
bool$includeprivacyinfoDo we want to include privacy info?
int$limitfrom
int$limitnum
Return values
array

◆ get_conversation_members_parameters()

static core_message_external::get_conversation_members_parameters ( )
static

Returns get conversation members parameters description.

Return values
external_function_parameters

◆ get_conversation_members_returns()

static core_message_external::get_conversation_members_returns ( )
static

Returns the get conversation members return description.

Return values
core_external\external_description

◆ get_conversation_messages()

static core_message_external::get_conversation_messages ( int $currentuserid,
int $convid,
int $limitfrom = 0,
int $limitnum = 0,
bool $newest = false,
int $timefrom = 0 )
static

Get conversation messages.

Parameters
int$currentuseridThe current user's id.
int$convidThe conversation id.
int$limitfromReturn a subset of records, starting at this point (optional).
int$limitnumReturn a subset comprising this many records in total (optional, required if $limitfrom is set).
bool$newestTrue for getting first newest messages, false otherwise.
int$timefromThe time from the conversation messages to get.
Return values
arrayThe messages and members who have sent some of these messages.
Exceptions
moodle_exception
Since
3.6

◆ get_conversation_messages_parameters()

static core_message_external::get_conversation_messages_parameters ( )
static

The conversation messages parameters.

Return values
external_function_parameters
Since
3.6

◆ get_conversation_messages_returns()

static core_message_external::get_conversation_messages_returns ( )
static

The messagearea messages return structure.

Return values
external_single_structure
Since
3.6

◆ get_conversation_parameters()

static core_message_external::get_conversation_parameters ( )
static

Get conversation parameters.

Return values
external_function_parameters

◆ get_conversation_returns()

static core_message_external::get_conversation_returns ( )
static

Get conversation returns.

Return values
external_single_structure

◆ get_conversations()

static core_message_external::get_conversations ( $userid,
$limitfrom = 0,
$limitnum = 0,
int $type = null,
bool $favourites = null,
bool $mergeself = false )
static

Get the list of conversations for the user.

Parameters
int$useridThe id of the user who is performing the search
int$limitfrom
int$limitnum
int | null$type
bool | null$favourites
bool$mergeselfwhether to include self-conversations (true) or ONLY private conversations (false) when private conversations are requested.
Return values
stdClass
Exceptions
moodle_exceptionif the messaging feature is disabled on the site.
Since
3.2

◆ get_conversations_parameters()

static core_message_external::get_conversations_parameters ( )
static

Get conversations parameters.

Return values
external_function_parameters
Since
3.6

◆ get_conversations_returns()

static core_message_external::get_conversations_returns ( )
static

Get conversations returns.

Return values
external_single_structure
Since
3.6

◆ get_member_info()

static core_message_external::get_member_info ( int $referenceuserid,
array $userids,
bool $includecontactrequests = false,
bool $includeprivacyinfo = false )
static

Returns conversation member info for the supplied users, relative to the supplied referenceuserid.

This is the basic structure used when returning members, and includes information about the relationship between each member and the referenceuser, such as a whether the referenceuser has marked the member as a contact, or has blocked them.

Parameters
int$referenceuseridthe id of the user which check contact and blocked status.
array$userids
Return values
arraythe array of objects containing member info.
Exceptions
moodle_exceptionif messaging is disabled or if the user cannot perform the action.

◆ get_member_info_parameters()

static core_message_external::get_member_info_parameters ( )
static

Returns description of method parameters for get_member_info() method.

Return values
external_function_parameters

◆ get_member_info_returns()

static core_message_external::get_member_info_returns ( )
static

Get member info return description.

Return values
core_external\external_description

◆ get_message_processor()

static core_message_external::get_message_processor ( $userid,
$name )
static

Get a message processor.

Parameters
int$userid
string$namethe name of the processor
Return values
core_external\external_description
Exceptions
moodle_exception
Since
3.2

◆ get_message_processor_parameters()

static core_message_external::get_message_processor_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
3.2

◆ get_message_processor_returns()

static core_message_external::get_message_processor_returns ( )
static

Returns description of method result value.

Return values
core_external\external_description
Since
3.2

◆ get_messages()

static core_message_external::get_messages ( $useridto,
$useridfrom = 0,
$type = 'both',
$read = MESSAGE_GET_READ,
$newestfirst = true,
$limitfrom = 0,
$limitnum = 0 )
static

Get messages function implementation.

Since
2.8
Exceptions
invalid_parameter_exception
moodle_exception
Parameters
int$useridtothe user id who received the message
int$useridfromthe user id who send the message. -10 or -20 for no-reply or support user
string$typetype of message to return, expected values: notifications, conversations and both
int$read1 for getting read messages, 0 for unread, 2 for both
bool$newestfirsttrue for ordering by newest first, false for oldest first
int$limitfromlimit from
int$limitnumlimit num
Return values
core_external\external_description

◆ get_messages_parameters()

static core_message_external::get_messages_parameters ( )
static

Get messages parameters description.

Return values
external_function_parameters
Since
2.8

◆ get_messages_returns()

static core_message_external::get_messages_returns ( )
static

Get messages return description.

Return values
external_single_structure
Since
2.8

◆ get_preferences_structure()

static core_message_external::get_preferences_structure ( )
staticprotected

Returns a notification or message preference structure.

Return values
external_single_structurethe structure
Since
Moodle 3.2
Todo
Remove loggedin and loggedoff from processors structure on MDL-73284.

◆ get_received_contact_requests_count()

static core_message_external::get_received_contact_requests_count ( int $userid)
static

Returns the number of contact requests the user has received.

Parameters
int$useridThe ID of the user we want to return the number of received contact requests for
Return values
external_value

◆ get_received_contact_requests_count_parameters()

static core_message_external::get_received_contact_requests_count_parameters ( )
static

Returns the number of contact requests the user has received parameters description.

Return values
external_function_parameters

◆ get_received_contact_requests_count_returns()

static core_message_external::get_received_contact_requests_count_returns ( )
static

Returns the number of contact requests the user has received return description.

Return values
external_value

◆ get_self_conversation()

static core_message_external::get_self_conversation ( int $userid,
int $messagelimit = 0,
int $messageoffset = 0,
bool $newestmessagesfirst = true )
static

Get a single self-conversation.

Parameters
int$useridThe user id to get the self-conversation for
int$messagelimitLimit number of messages to load
int$messageoffsetOffset the messages
bool$newestmessagesfirstOrder messages by newest first
Return values
stdClass
Exceptions
moodle_exceptionif the messaging feature is disabled on the site.
Since
Moodle 3.7

◆ get_self_conversation_parameters()

static core_message_external::get_self_conversation_parameters ( )
static

Get self-conversation parameters.

Return values
external_function_parameters

◆ get_self_conversation_returns()

static core_message_external::get_self_conversation_returns ( )
static

Get conversation returns.

Return values
external_single_structure

◆ get_unread_conversation_counts()

static core_message_external::get_unread_conversation_counts ( int $userid)
static

Returns an array of unread conversation counts for the various types of conversations, including favourites.

Return format: [ 'favourites' => 0, 'types' => [ core_message\api\MESSAGE_CONVERSATION_TYPE_INDIVIDUAL => 0, core_message\api\MESSAGE_CONVERSATION_TYPE_GROUP => 0 ] ]

Parameters
int$useridthe id of the user whose counts we are fetching.
Return values
arraythe array of unread conversation counts, indexed by type.
Exceptions
moodle_exceptionif the current user cannot perform this action.

◆ get_unread_conversation_counts_parameters()

static core_message_external::get_unread_conversation_counts_parameters ( )
static

Returns description of method parameters for get_unread_conversation_counts() method.

Return values
external_function_parameters

◆ get_unread_conversation_counts_returns()

static core_message_external::get_unread_conversation_counts_returns ( )
static

Get unread conversation counts return description.

Return values
core_external\external_description

◆ get_unread_conversations_count()

static core_message_external::get_unread_conversations_count ( $useridto)
static

Get unread messages count function.

Since
3.2
Exceptions
invalid_parameter_exception
moodle_exception
Parameters
int$useridtothe user id who received the message
Return values
core_external\external_description

◆ get_unread_conversations_count_parameters()

static core_message_external::get_unread_conversations_count_parameters ( )
static

Get unread conversations count parameters description.

Return values
external_function_parameters
Since
3.2

◆ get_unread_conversations_count_returns()

static core_message_external::get_unread_conversations_count_returns ( )
static

Get unread conversations count return description.

Return values
external_single_structure
Since
3.2

◆ get_user_contacts()

static core_message_external::get_user_contacts ( int $userid,
int $limitfrom = 0,
int $limitnum = 0 )
static

Get user contacts.

Parameters
int$useridThe id of the user who we are viewing conversations for
int$limitfrom
int$limitnum
Return values
array
Exceptions
moodle_exception

◆ get_user_contacts_parameters()

static core_message_external::get_user_contacts_parameters ( )
static

The user contacts return parameters.

Return values
external_function_parameters

◆ get_user_contacts_returns()

static core_message_external::get_user_contacts_returns ( )
static

The user contacts return structure.

Return values
external_multiple_structure

◆ get_user_message_preferences()

static core_message_external::get_user_message_preferences ( $userid = 0)
static

Get the notification preferences for a given user.

Parameters
int$useridid of the user, 0 for current user
Return values
core_external\external_description
Exceptions
moodle_exception
Since
3.2

◆ get_user_message_preferences_parameters()

static core_message_external::get_user_message_preferences_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
3.2

◆ get_user_message_preferences_returns()

static core_message_external::get_user_message_preferences_returns ( )
static

Returns description of method result value.

Return values
core_external\external_description
Since
3.2

◆ get_user_notification_preferences()

static core_message_external::get_user_notification_preferences ( $userid = 0)
static

Get the notification preferences for a given user.

Parameters
int$useridid of the user, 0 for current user
Return values
core_external\external_description
Exceptions
moodle_exception
Since
3.2

◆ get_user_notification_preferences_parameters()

static core_message_external::get_user_notification_preferences_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
3.2

◆ get_user_notification_preferences_returns()

static core_message_external::get_user_notification_preferences_returns ( )
static

Returns description of method result value.

Return values
core_external\external_description
Since
3.2

◆ mark_all_conversation_messages_as_read()

static core_message_external::mark_all_conversation_messages_as_read ( int $userid,
int $conversationid )
static

Mark all conversation messages as read function.

Parameters
int$useridThe user id of who we want to delete the conversation for
int$conversationidThe id of the conversations
Since
3.6

◆ mark_all_conversation_messages_as_read_parameters()

static core_message_external::mark_all_conversation_messages_as_read_parameters ( )
static

Mark all conversation messages as read parameters description.

Return values
external_function_parameters
Since
3.6

◆ mark_all_conversation_messages_as_read_returns()

static core_message_external::mark_all_conversation_messages_as_read_returns ( )
static

Mark all conversation messages as read return description.

Return values
external_warnings
Since
3.6

◆ mark_all_notifications_as_read()

static core_message_external::mark_all_notifications_as_read ( $useridto,
$useridfrom,
$timecreatedto = 0 )
static

Mark all notifications as read function.

Since
3.2
Exceptions
invalid_parameter_exception
moodle_exception
Parameters
int$useridtothe user id who received the message
int$useridfromthe user id who send the message. -10 or -20 for no-reply or support user
int$timecreatedtomark message created before this time as read, 0 for all messages
Return values
core_external\external_description

◆ mark_all_notifications_as_read_parameters()

static core_message_external::mark_all_notifications_as_read_parameters ( )
static

Mark all notifications as read parameters description.

Return values
external_function_parameters
Since
3.2

◆ mark_all_notifications_as_read_returns()

static core_message_external::mark_all_notifications_as_read_returns ( )
static

Mark all notifications as read return description.

Return values
external_single_structure
Since
3.2

◆ mark_message_read()

static core_message_external::mark_message_read ( $messageid,
$timeread )
static

Mark a single message as read, trigger message_viewed event.

Parameters
int$messageidid of the message (in the message table)
int$timereadtimestamp for when the message should be marked read
Return values
core_external\external_description
Exceptions
invalid_parameter_exception
moodle_exception
Since
2.9

◆ mark_message_read_parameters()

static core_message_external::mark_message_read_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
2.9

◆ mark_message_read_returns()

static core_message_external::mark_message_read_returns ( )
static

Returns description of method result value.

Return values
core_external\external_description
Since
2.9

◆ mark_notification_read()

static core_message_external::mark_notification_read ( $notificationid,
$timeread )
static

Mark a single notification as read.

This will trigger a 'notification_viewed' event.

Parameters
int$notificationidid of the notification
int$timereadtimestamp for when the notification should be marked read
Return values
core_external\external_description
Exceptions
invalid_parameter_exception
moodle_exception

◆ mark_notification_read_parameters()

static core_message_external::mark_notification_read_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters

◆ mark_notification_read_returns()

static core_message_external::mark_notification_read_returns ( )
static

Returns description of method result value.

Return values
core_external\external_description

◆ message_processor_config_form()

static core_message_external::message_processor_config_form ( $userid,
$name,
$formvalues )
static

Processes a message processor config form.

Parameters
int$useridthe user id
string$namethe name of the processor
array$formvaluesthe form values
Return values
core_external\external_description
Exceptions
moodle_exception
Since
3.2

◆ message_processor_config_form_parameters()

static core_message_external::message_processor_config_form_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
3.2

◆ message_processor_config_form_returns()

static core_message_external::message_processor_config_form_returns ( )
static

Returns description of method result value.

Return values
core_external\external_description
Since
3.2

◆ message_search_users()

static core_message_external::message_search_users ( $userid,
$search,
$limitfrom = 0,
$limitnum = 0 )
static

Get search users results.

Parameters
int$useridThe id of the user who is performing the search
string$searchThe string being searched
int$limitfrom
int$limitnum
Return values
array
Exceptions
moodle_exception
Since
3.6

◆ message_search_users_parameters()

static core_message_external::message_search_users_parameters ( )
static

Get messagearea message search users parameters.

Return values
external_function_parameters
Since
3.6

◆ message_search_users_returns()

static core_message_external::message_search_users_returns ( )
static

Get messagearea message search users returns.

Return values
external_single_structure
Since
3.2

◆ mute_conversations()

static core_message_external::mute_conversations ( int $userid,
array $conversationids )
static

Mutes conversations.

Parameters
int$useridThe id of the user who is blocking
array$conversationidsThe list of conversations being muted
Return values
core_external\external_description

◆ mute_conversations_parameters()

static core_message_external::mute_conversations_parameters ( )
static

Mute conversations parameters description.

Return values
external_function_parameters

◆ mute_conversations_returns()

static core_message_external::mute_conversations_returns ( )
static

Mute conversations return description.

Return values
core_external\external_description

◆ search_contacts()

static core_message_external::search_contacts ( $searchtext,
$onlymycourses = false )
static

Search contacts.

Parameters
string$searchtextquery string.
bool$onlymycourseslimit the search to the user's courses only.
Return values
core_external\external_description
Since
Moodle 2.5

◆ search_contacts_parameters()

static core_message_external::search_contacts_parameters ( )
static

Search contacts parameters description.

Return values
external_function_parameters
Since
Moodle 2.5

◆ search_contacts_returns()

static core_message_external::search_contacts_returns ( )
static

Search contacts return description.

Return values
core_external\external_description
Since
Moodle 2.5

◆ send_instant_messages()

static core_message_external::send_instant_messages ( $messages = array())
static

Send private messages from the current USER to other users.

Parameters
array$messagesAn array of message to send.
Return values
array
Since
Moodle 2.2

◆ send_instant_messages_parameters()

static core_message_external::send_instant_messages_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 2.2

◆ send_instant_messages_returns()

static core_message_external::send_instant_messages_returns ( )
static

Returns description of method result value.

Return values
core_external\external_description
Since
Moodle 2.2

◆ send_messages_to_conversation()

static core_message_external::send_messages_to_conversation ( int $conversationid,
array $messages = [] )
static

Send messages from the current USER to a conversation.

This conversation may be any type of conversation, individual or group.

Parameters
int$conversationidthe id of the conversation to which the messages will be sent.
array$messagesAn array of message to send.
Return values
arraythe array of messages which were sent (created).
Since
Moodle 3.6

◆ send_messages_to_conversation_parameters()

static core_message_external::send_messages_to_conversation_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 3.6

◆ send_messages_to_conversation_returns()

static core_message_external::send_messages_to_conversation_returns ( )
static

Returns description of method result value.

Return values
core_external\external_description
Since
Moodle 3.6

◆ set_favourite_conversations()

static core_message_external::set_favourite_conversations ( int $userid,
array $conversationids )
static

Favourite a conversation, or list of conversations for a user.

Parameters
int$useridthe id of the user, or 0 for the current user.
array$conversationidsthe list of conversations ids to favourite.
Return values
array
Exceptions
moodle_exceptionif messaging is disabled or if the user cannot perform the action.

◆ set_favourite_conversations_parameters()

static core_message_external::set_favourite_conversations_parameters ( )
static

Returns description of method parameters for the favourite_conversations() method.

Return values
external_function_parameters

◆ set_favourite_conversations_returns()

static core_message_external::set_favourite_conversations_returns ( )
static

Return a description of the returns for the create_user_favourite_conversations() method.

Return values
core_external\external_description

◆ unblock_user()

static core_message_external::unblock_user ( int $userid,
int $unblockeduserid )
static

Unblock user.

Parameters
int$useridThe id of the user who is unblocking
int$unblockeduseridThe id of the user being unblocked

◆ unblock_user_parameters()

static core_message_external::unblock_user_parameters ( )
static

Unblock user parameters description.

Return values
external_function_parameters

◆ unblock_user_returns()

static core_message_external::unblock_user_returns ( )
static

Unblock user return description.

Return values
core_external\external_description

◆ unmute_conversations()

static core_message_external::unmute_conversations ( int $userid,
array $conversationids )
static

Unmute conversations.

Parameters
int$useridThe id of the user who is unblocking
array$conversationidsThe list of conversations being muted

◆ unmute_conversations_parameters()

static core_message_external::unmute_conversations_parameters ( )
static

Unmute conversations parameters description.

Return values
external_function_parameters

◆ unmute_conversations_returns()

static core_message_external::unmute_conversations_returns ( )
static

Unmute conversations return description.

Return values
core_external\external_description

◆ unset_favourite_conversations()

static core_message_external::unset_favourite_conversations ( int $userid,
array $conversationids )
static

Unfavourite a conversation, or list of conversations for a user.

Parameters
int$useridthe id of the user, or 0 for the current user.
array$conversationidsthe list of conversations ids unset as favourites.
Return values
array
Exceptions
moodle_exceptionif messaging is disabled or if the user cannot perform the action.

◆ unset_favourite_conversations_parameters()

static core_message_external::unset_favourite_conversations_parameters ( )
static

Returns description of method parameters for unfavourite_conversations() method.

Return values
external_function_parameters

◆ unset_favourite_conversations_returns()

static core_message_external::unset_favourite_conversations_returns ( )
static

Unset favourite conversations return description.

Return values
core_external\external_description

◆ validate_preferences_permissions()

static core_message_external::validate_preferences_permissions ( $userid)
staticprotected

Check that the user has enough permission to retrieve message or notifications preferences.

Parameters
int$useridthe user id requesting the preferences
Return values
stdClassfull user object
Exceptions
moodle_exception
Since
Moodle 3.2

The documentation for this class was generated from the following file: