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()
22 * The following functions have been deprecated and should not be used any more:
23 - message_add_contact()
24 - message_remove_contact()
25 - message_unblock_contact()
26 - message_block_contact()
27 - message_get_contact()
28 Please see their declaration in lib/deprecatedlib.php to view their alternatives (if applicable).
29 * The following methods have been deprecated and should not be used any more:
30 - \core_message\api::is_user_blocked()
31 - \core_message\api::delete_conversation()
32 - \core_message\api::is_user_non_contact_blocked()
33 - \core_message\api::create_conversation_between_users()
34 * The method \core_message\api::can_delete_conversation() now expects a 'conversationid' to be passed
35 as the second parameter.
36 * The following web services have been deprecated. Please do not call these any more.
37 - core_message_external::block_contacts(), please use core_message_external::block_user() instead.
38 - core_message_external::unblock_contacts(), please use core_message_external::unblock_user() instead.
39 - core_message_external::create_contacts(), please use core_message_external::create_contact_request() instead.
40 - core_message_external::delete_conversation(), please use core_message_external::delete_conversations_by_id() instead.
41 * The following function has been added for getting the privacy messaging preference:
42 - get_user_privacy_messaging_preference()
46 * Changed the database structure so there are no longer two tables for messages, with the only
47 difference being that one stores read messages. The 'message' and 'message_read' tables are
48 still present in core but will no longer be populated by core APIs. The data will be
49 transferred to the new database structure via an ad-hoc task. Please be patient. This can
51 The new database structure is as follows -
52 'messages' - Stores the messages with a 'useridfrom' field specifying the user who sent the
53 message and a 'conversationid' field specifying which conversation it is for.
54 'message_conversations' - The list of conversations.
55 'message_conversation_members' - The list of users in each conversation.
56 'message_user_actions' - The list of user actions against a message, eg. read/deleted.
57 'notifications' - This has a very similar structure to the old table 'message' and still
58 has a one-to-one relation between users.
59 Due to these huge differences the events message_sent, message_deleted and message_viewed
60 have changed quite a lot. Please, if you have any observers or are triggering these events
61 in your code you will have to make some changes!
62 * The webservice external function 'core_message_mark_message_read' now only marks messages as
63 read, and not notifications. A new external function 'core_message_mark_notification_read' was
64 added to mark notifications as read.
65 * Deprecated the following functions.
66 - message_move_userfrom_unread2read
67 - message_get_blocked_users
68 - message_get_contacts
69 - message_mark_message_read
70 - message_can_delete_message
71 - message_delete_message
72 - \core_message\api::mark_all_read_for_user
73 Please see their declaration in lib/deprecatedlib.php to view their alternatives (if applicable).
74 * Final deprecation of the following functions.
75 - message_get_recent_notifications
78 - message_get_recent_conversations
79 * Added new events for when a notification is sent and viewed.
80 * Removed the database table 'message_working'. The 'message_working' table was introduced when
81 the messaging system was first introduced in Moodle, so, a long time ago. It was never necessary.
82 * Replaced the usage of the table 'message_popup' to a new table 'message_popup_notifications'.
86 * Removed all message_print_* functions as well as the files search.html, search_advanced.html and
87 send_form.php due to messaging UI rehaul.
88 * Deprecated the following functions as they are no longer used.
89 - message_get_course_contexts
90 - message_remove_url_params
91 - message_count_messages
92 - message_count_blocked_users
93 - message_contact_link
94 - message_get_recent_notifications
95 - message_history_link
97 - message_shorten_message
98 - message_get_fragment
100 - message_get_contact_add_remove_link
101 - message_get_contact_block_link
102 - message_mark_messages_read
103 - message_page_type_list
104 - message_can_post_message
105 - message_is_user_non_contact_blocked
106 - message_is_user_blocked
109 * get_message_processors accepts an addition parameter for testing, which will just reset processor and exit.
110 * Deprecated method message_current_user_is_involved() has been removed.
113 * Renderer method \core_message_renderer::manage_messagingoptions now accepts a user id parameter as well.
116 * Message processor extending message_output, should return true in can_send_to_any_users()
117 if it supports message sending to internal (noreply/support) users.
118 * Message API has been changed to allow attachments. Message processors that can support
119 attachments can now use additional parameter as a part of $eventdata. To send attachments,
120 $eventdata should contain properties called "attachment" (must be stored_file) and
121 "attachname" (string). Currently, email message processor is the only one to support
127 * lib/messagelib.php message_send($eventdata)
128 $eventdata->userto should contain a property called "emailstop", $eventdata->userto->emailstop
129 If it is absent it will be retrieved from the user table causing an additional database query