1 This files describes API changes in /message/ messaging system,
2 information provided here is intended especially for developers.
6 * Changed the database structure so there are no longer two tables for messages, with the only
7 difference being that one stores read messages. The 'message' and 'message_read' tables are
8 still present in core but will no longer be populated by core APIs. The data will be
9 transferred to the new database structure via an ad-hoc task. Please be patient. This can
11 The new database structure is as follows -
12 'messages' - Stores the messages with a 'useridfrom' field specifying the user who sent the
13 message and a 'conversationid' field specifying which conversation it is for.
14 'message_conversations' - The list of conversations.
15 'message_conversation_members' - The list of users in each conversation.
16 'message_user_actions' - The list of user actions against a message, eg. read/deleted.
17 'notifications' - This has a very similar structure to the old table 'message' and still
18 has a one-to-one relation between users.
19 Due to these huge differences the events message_sent, message_deleted and message_viewed
20 have changed quite a lot. Please, if you have any observers or are triggering these events
21 in your code you will have to make some changes!
22 * The webservice external function 'core_message_mark_message_read' now only marks messages as
23 read, and not notifications. A new external function 'core_message_mark_notification_read' was
24 added to mark notifications as read.
25 * Deprecated the following functions.
26 - message_move_userfrom_unread2read
27 - message_get_blocked_users
28 - message_get_contacts
29 - message_mark_message_read
30 - message_can_delete_message
31 - message_delete_message
32 - \core_message\api::mark_all_read_for_user
33 Please see their declaration in lib/deprecatedlib.php to view their alternatives (if applicable).
34 * Final deprecation of the following functions.
35 - message_get_recent_notifications
38 - message_get_recent_conversations
39 * Added new events for when a notification is sent and viewed.
40 * Removed the database table 'message_working'. The 'message_working' table was introduced when
41 the messaging system was first introduced in Moodle, so, a long time ago. It was never necessary.
42 * Replaced the usage of the table 'message_popup' to a new table 'message_popup_notifications'.
46 * Removed all message_print_* functions as well as the files search.html, search_advanced.html and
47 send_form.php due to messaging UI rehaul.
48 * Deprecated the following functions as they are no longer used.
49 - message_get_course_contexts
50 - message_remove_url_params
51 - message_count_messages
52 - message_count_blocked_users
53 - message_contact_link
54 - message_get_recent_notifications
55 - message_history_link
57 - message_shorten_message
58 - message_get_fragment
60 - message_get_contact_add_remove_link
61 - message_get_contact_block_link
62 - message_mark_messages_read
63 - message_page_type_list
64 - message_can_post_message
65 - message_is_user_non_contact_blocked
66 - message_is_user_blocked
69 * get_message_processors accepts an addition parameter for testing, which will just reset processor and exit.
70 * Deprecated method message_current_user_is_involved() has been removed.
73 * Renderer method \core_message_renderer::manage_messagingoptions now accepts a user id parameter as well.
76 * Message processor extending message_output, should return true in can_send_to_any_users()
77 if it supports message sending to internal (noreply/support) users.
78 * Message API has been changed to allow attachments. Message processors that can support
79 attachments can now use additional parameter as a part of $eventdata. To send attachments,
80 $eventdata should contain properties called "attachment" (must be stored_file) and
81 "attachname" (string). Currently, email message processor is the only one to support
87 * lib/messagelib.php message_send($eventdata)
88 $eventdata->userto should contain a property called "emailstop", $eventdata->userto->emailstop
89 If it is absent it will be retrieved from the user table causing an additional database query