Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Class: mod_chat_external  - X-Ref

Chat external functions

login_user_parameters()   X-Ref
Returns description of method parameters

return: external_function_parameters

login_user($chatid, $groupid = 0)   X-Ref
Log the current user into a chat room in the given chat.

param: int $chatid the chat instance id
param: int $groupid the user group id
return: array of warnings and the chat unique session id

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

return: external_description

get_chat_users_parameters()   X-Ref
Returns description of method parameters

return: external_function_parameters

get_chat_users($chatsid)   X-Ref
Get the list of users in the given chat session.

param: int $chatsid the chat session id
return: array of warnings and the user lists

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

return: external_description

send_chat_message_parameters()   X-Ref
Returns description of method parameters

return: external_function_parameters

send_chat_message($chatsid, $messagetext, $beepid = '')   X-Ref
Send a message on the given chat session.

param: int $chatsid the chat session id
param: string $messagetext the message text
param: string $beepid the beep message id
return: array of warnings and the new message id (0 if the message was empty)

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

return: external_description

get_chat_latest_messages_parameters()   X-Ref
Returns description of method parameters

return: external_function_parameters

get_chat_latest_messages($chatsid, $chatlasttime = 0)   X-Ref
Get the latest messages from the given chat session.

param: int $chatsid the chat session id
param: int $chatlasttime last time messages were retrieved (epoch time)
return: array of warnings and the new message id (0 if the message was empty)

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

return: external_description

view_chat_parameters()   X-Ref
Returns description of method parameters

return: external_function_parameters

view_chat($chatid)   X-Ref
Trigger the course module viewed event and update the module completion status.

param: int $chatid the chat instance id
return: array of warnings and status result

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

return: external_description

get_chats_by_courses_parameters()   X-Ref
Describes the parameters for get_chats_by_courses.

return: external_function_parameters

get_chats_by_courses($courseids = array()   X-Ref
Returns a list of chats in a provided list of courses,
if no list is provided all chats that the user can view will be returned.

param: array $courseids the course ids
return: array of chats details

get_chats_by_courses_returns()   X-Ref
Describes the get_chats_by_courses return value.

return: external_single_structure

get_sessions_parameters()   X-Ref
Returns description of method parameters

return: external_function_parameters

get_sessions($chatid, $groupid = 0, $showall = false)   X-Ref
Retrieves chat sessions for a given chat.

param: int $chatid the chat instance id
param: int $groupid filter messages by this group. 0 to determine the group.
param: bool $showall whether to include incomplete sessions or not
return: array of warnings and the sessions

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

return: external_description

get_session_messages_parameters()   X-Ref
Returns description of method parameters

return: external_function_parameters

get_session_messages($chatid, $sessionstart, $sessionend, $groupid = 0)   X-Ref
Retrieves messages of the given chat session.

param: int $chatid the chat instance id
param: int $sessionstart the session start time (timestamp)
param: int $sessionend the session end time (timestamp)
param: int $groupid filter messages by this group. 0 to determine the group.
return: array of warnings and the messages

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

return: external_description