1 This files describes API changes in /mod/forum/*,
2 information provided here is intended especially for developers.
6 * The following code, previously used (exclusively) by upgrade steps is not available anymore
7 because of the upgrade cleanup performed for this version. See MDL-71747 for more info:
8 - \mod_forum\task\refresh_forum_post_counts adhoc task.
12 * The forum_count_replies() function has been removed from core.
13 * The mod_forum_get_forum_discussion_posts web service has been removed from core.
14 * Final deprecations of the following functions:
15 * forum_make_mail_text
16 * forum_make_mail_html
17 * forum_make_mail_post
18 * forum_cron_minimise_user_record
20 * forum_print_discussion
21 * forum_post_nesting_cache
22 * forum_should_start_post_nesting
23 * forum_should_end_post_nesting
24 * forum_print_post_start
25 * forum_print_post_end
27 * forum_print_posts_flat
28 * forum_print_posts_threaded
29 * forum_print_posts_nested
30 * forum_print_latest_discussions
31 * forum_get_user_grades
32 * The method forum_update_subscriptions_button() has been deprecated as it is no longer used.
33 The 'Manage subscribers' button has been replaced with tertiary navigation.
37 * The get_forum_discussions_paginated web service has been deprecated in favour of get_forum_discussions.
38 * The forum post exporter now includes a "timemodified" field for each post, which is included in several WS methods:
39 * mod_forum_get_discussion_posts
40 * get_discussion_posts_by_userid
46 * Changes in external function mod_forum_external::get_discussion_posts_by_userid
47 Now returns the posts of a given user checking the current user capabilities ($USER, the user who is requesting the posts).
48 Previously, it returned the posts checking the capabilities of the user that created the posts.
52 * The following functions have been finally deprecated and can not be used anymore:
54 * In order for the forum summary report to calculate word count and character count data, those details are now stored
55 for each post in the database when posts are created or updated. For posts that existed prior to a Moodle 3.8 upgrade, these
56 are calculated by the refresh_forum_post_counts ad-hoc task in chunks of 5000 posts by default. Site admins are able to modify this
57 default, by setting $CFG->forumpostcountchunksize to the required integer value.
60 * Changed the forum discussion rendering to use templates rather than print functions.
61 * Added new forum entities, factories, exporters, renderers, and vaults in the local namespace to better encapsulate the forum data.
62 * Deprecated all of the forum_print_* functions in lib.php.
63 * The forum_print_latest_discussions function has been deprecated and will not be replaced.
64 * The get_forum_discussion_posts web service has been deprecated in favour of get_discussion_posts.
65 * The forum_count_replies function has been deprecated in favour of get_reply_count_for_post_id_in_discussion_id in
67 * External function get_forums_by_courses now returns two additional fields "duedate" and "cutoffdate" containing the due date and the cutoff date for posting to the forums respectively.
68 * External function get_forum_discussion_posts now returns an additional field "tags" returning the post tags.
69 * New external function mod_forum_external::get_forum_discussions returns a list of forum discussions optionally sorted and paginated.
70 Use mod_forum_external::get_forum_discussions instead.
71 * External function mod_forum_external::add_discussion_post() has a new 'messageformat' param to be able to handle other formats different from FORMAT_HTML (that continues being the default one). Also a new 'topreferredformat' option enables the automatic conversion between any format and the preferred format (given the editor preference) before contents are saved.
75 * forum_print_post should be surrounded with calls to forum_print_post_start and forum_print_post_end to create the proper HTML structure for the post.
78 * External function get_forum_discussion_posts now returns an additional field "ratinginfo" containing rating information.
81 * External function get_forums_by_courses now returns and additional field "istracked" that indicates if the user
82 is tracking the related forum.
83 * The legacy forum.js file has been removed, this includes the js functions:
84 forum_produce_subscribe_link, forum_produce_tracking_link, lockoptions_timetoitems,
85 lockoptions_timefromitems, lockoptions, lockoption, unlockoption
86 * External function can_add_discussion now returns two additional fields:
87 "canpindiscussions" that indicates if the user can add pinned discussions.
88 "cancreateattachment" that indicates if the user can add attachments to the discussion.
91 * The setting $CFG->forum_replytouser has been removed in favour of a centralized noreplyaddress setting.
92 Please use $CFG->noreplyaddress setting instead.
93 * The following functions have been finally deprecated and should no longer be used.
94 - forum_count_unrated_posts
95 - forum_tp_count_discussion_read_records
96 - forum_get_user_discussions
97 - forum_tp_count_forum_posts
98 - forum_tp_count_forum_read_records
99 - forum_get_open_modes
100 - forum_get_child_posts
101 - forum_get_discussion_posts
103 - forum_get_tracking_link
104 - forum_tp_count_discussion_unread_posts
105 - forum_convert_to_roles
106 - forum_tp_get_read_records
107 - forum_tp_get_discussion_read_records
108 - forum_user_enrolled
109 - forum_user_can_view_post
111 - forum_is_subscribed
114 - forum_subscribed_users
115 - forum_is_forcesubscribed
116 - forum_forcesubscribe
117 - forum_get_forcesubscribed
118 - forum_get_subscribed_forums
119 - forum_get_optional_subscribed_forums
120 - forum_get_potential_subscribers
121 * External functions that were returning file information now return the following file fields:
122 filename, filepath, mimetype, filesize, timemodified and fileurl.
123 Those fields are now marked as VALUE_OPTIONAL for backwards compatibility.
126 * The inteface to forum_get_email_message_id() has changed and no longer needs the $host argument.
129 * External function get_forums_by_courses now returns and additional field "cancreatediscussions" that indicates if the user
130 can create discussions in the forum.
131 * A new optional parameter (groupid) has been added to get_forum_discussions.
132 This parameter can override the automatically calculated current group.
133 * New constant FORUM_POSTS_ALL_USER_GROUPS, to be used as parameter in functions where we'd need to retrieve all the user posts.
136 * The following functions have all been marked as deprecated. Many of
137 these have not been supported in many releases and should not be relied
139 forum_count_unrated_posts
140 forum_tp_count_discussion_read_records
141 forum_get_user_discussions
142 forum_tp_count_forum_posts
143 forum_tp_count_forum_read_records
145 forum_get_child_posts
146 forum_get_discussion_posts
148 forum_get_tracking_link
149 forum_tp_count_discussion_unread_posts
150 forum_convert_to_roles
151 forum_tp_get_read_records
152 forum_tp_get_discussion_read_records
154 forum_user_can_view_post
155 * The following functions have been deprecated and replaced. Please see the phpdoc for each on the new function to use instead:
156 * forum_is_subscribed
159 * forum_subscribed_users
160 * forum_is_forcesubscribed
161 * forum_forcesubscribe
162 * forum_get_forcesubscribed
163 * forum_get_subscribed_forums
164 * forum_get_optional_subscribed_forums
165 * forum_get_potential_subscribers
166 * External function mod_forum_external::get_forum_discussions has been deprecated.
167 Use mod_forum_external::get_forum_discussions_paginated instead.
171 * The file post_form.php should not be included, the class it contained has
172 been moved so that it can benefit from autoloading.
173 * The function forum_shorten_post() has been deprecated. It was doing a poor
174 job of shortening forum post text and the shorten_text() function does a
176 * The constant FORUM_TRACKING_ON has been deprecated and replaced by
177 FORUM_TRACKING_FORCED. The value between them is maintained, so they are
178 interchangeable, but code should migrate to the new name.
182 The function forum_check_throttling has been changed so that a warning object is returned when a user has reached the 'Post threshold for warning' or
183 'Post threshold for blocking' setting, rather than echoing this on screen. This allows the warning to be moved inside the post form as it can be added
184 as a HTML element, where it is more noticeable. False is returned if there is no need to warn, or restrict the user from posting - see MDL-39182.
188 * mod/forum:allowforcesubscribe capability will be forcefully assigned to frontpage role, as it was mistakenly missed off
189 when the capability was initially created. If you don't want users with frontpage role to get forum (with forcesubscribe) emails,
190 then please remove this capability for frontpage role.