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