This files describes API changes in /mod/forum/*,
information provided here is intended especially for developers.

=== 4.4 ===

* The mod_forum_get_forum_discussions_paginated web service has been removed from core.

=== 4.3 ===

* The forum_print_discussion_header function has been deprecated and will not be replaced.

=== 4.1 ===

* The following code, previously used (exclusively) by upgrade steps is not available anymore
  because of the upgrade cleanup performed for this version. See MDL-71747 for more info:
    - \mod_forum\task\refresh_forum_post_counts adhoc task.

=== 4.0 ===

* The forum_count_replies() function has been removed from core.
* The mod_forum_get_forum_discussion_posts web service has been removed from core.
* Final deprecations of the following functions:
    * forum_make_mail_text
    * forum_make_mail_html
    * forum_make_mail_post
    * forum_cron_minimise_user_record
    * forum_cron
    * forum_print_discussion
    * forum_post_nesting_cache
    * forum_should_start_post_nesting
    * forum_should_end_post_nesting
    * forum_print_post_start
    * forum_print_post_end
    * forum_print_post
    * forum_print_posts_flat
    * forum_print_posts_threaded
    * forum_print_posts_nested
    * forum_print_latest_discussions
    * forum_get_user_grades
* The method forum_update_subscriptions_button() has been deprecated as it is no longer used.
  The 'Manage subscribers' button has been replaced with tertiary navigation.

=== 3.11 ===

* The get_forum_discussions_paginated web service has been deprecated in favour of get_forum_discussions.
* The forum post exporter now includes a "timemodified" field for each post, which is included in several WS methods:
    * mod_forum_get_discussion_posts
    * get_discussion_posts_by_userid
    * get_discussion_post
    * add_discussion_post

=== 3.10 ===

* Changes in external function mod_forum_external::get_discussion_posts_by_userid
  Now returns the posts of a given user checking the current user capabilities ($USER, the user who is requesting the posts).
  Previously, it returned the posts checking the capabilities of the user that created the posts.

=== 3.8 ===

* The following functions have been finally deprecated and can not be used anymore:
    * forum_scale_used()
* In order for the forum summary report to calculate word count and character count data, those details are now stored
    for each post in the database when posts are created or updated. For posts that existed prior to a Moodle 3.8 upgrade, these
    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
    default, by setting $CFG->forumpostcountchunksize to the required integer value.

=== 3.7 ===
  * Changed the forum discussion rendering to use templates rather than print functions.
  * Added new forum entities, factories, exporters, renderers, and vaults in the local namespace to better encapsulate the forum data.
  * Deprecated all of the forum_print_* functions in lib.php.
  * The forum_print_latest_discussions function has been deprecated and will not be replaced.
  * The get_forum_discussion_posts web service has been deprecated in favour of get_discussion_posts.
  * The forum_count_replies function has been deprecated in favour of get_reply_count_for_post_id_in_discussion_id in
    the Post vault.
  * 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.
  * External function get_forum_discussion_posts now returns an additional field "tags" returning the post tags.
  * New external function mod_forum_external::get_forum_discussions returns a list of forum discussions optionally sorted and paginated.
    Use mod_forum_external::get_forum_discussions instead.
  * 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.

=== 3.6 ===

  * 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.

=== 3.4 ===
  * External function get_forum_discussion_posts now returns an additional field "ratinginfo" containing rating information.

=== 3.3 ===
  * External function get_forums_by_courses now returns and additional field "istracked" that indicates if the user
   is tracking the related forum.
  * The legacy forum.js file has been removed, this includes the js functions:
    forum_produce_subscribe_link, forum_produce_tracking_link, lockoptions_timetoitems,
    lockoptions_timefromitems, lockoptions, lockoption, unlockoption
  * External function can_add_discussion now returns two additional fields:
   "canpindiscussions" that indicates if the user can add pinned discussions.
   "cancreateattachment" that indicates if the user can add attachments to the discussion.

=== 3.2 ===
 * The setting $CFG->forum_replytouser has been removed in favour of a centralized noreplyaddress setting.
   Please use $CFG->noreplyaddress setting instead.
 * The following functions have been finally deprecated and should no longer be used.
  - forum_count_unrated_posts
  - forum_tp_count_discussion_read_records
  - forum_get_user_discussions
  - forum_tp_count_forum_posts
  - forum_tp_count_forum_read_records
  - forum_get_open_modes
  - forum_get_child_posts
  - forum_get_discussion_posts
  - forum_get_ratings
  - forum_get_tracking_link
  - forum_tp_count_discussion_unread_posts
  - forum_convert_to_roles
  - forum_tp_get_read_records
  - forum_tp_get_discussion_read_records
  - forum_user_enrolled
  - forum_user_can_view_post
  - forum_shorten_post
  - forum_is_subscribed
  - forum_subscribe
  - forum_unsubscribe
  - forum_subscribed_users
  - forum_is_forcesubscribed
  - forum_forcesubscribe
  - forum_get_forcesubscribed
  - forum_get_subscribed_forums
  - forum_get_optional_subscribed_forums
  - forum_get_potential_subscribers
 * External functions that were returning file information now return the following file fields:
   filename, filepath, mimetype, filesize, timemodified and fileurl.
   Those fields are now marked as VALUE_OPTIONAL for backwards compatibility.

=== 3.1 ===
 * The inteface to forum_get_email_message_id() has changed and no longer needs the $host argument.

=== 3.0 ===
 * External function get_forums_by_courses now returns and additional field "cancreatediscussions" that indicates if the user
   can create discussions in the forum.
 * A new optional parameter (groupid) has been added to get_forum_discussions.
   This parameter can override the automatically calculated current group.
 * New constant FORUM_POSTS_ALL_USER_GROUPS, to be used as parameter in functions where we'd need to retrieve all the user posts.

=== 2.8 ===
 * The following functions have all been marked as deprecated. Many of
   these have not been supported in many releases and should not be relied
   upon:
     forum_count_unrated_posts
     forum_tp_count_discussion_read_records
     forum_get_user_discussions
     forum_tp_count_forum_posts
     forum_tp_count_forum_read_records
     forum_get_open_modes
     forum_get_child_posts
     forum_get_discussion_posts
     forum_get_ratings
     forum_get_tracking_link
     forum_tp_count_discussion_unread_posts
     forum_convert_to_roles
     forum_tp_get_read_records
     forum_tp_get_discussion_read_records
     forum_user_enrolled
     forum_user_can_view_post
 * The following functions have been deprecated and replaced. Please see the phpdoc for each on the new function to use instead:
   * forum_is_subscribed
   * forum_subscribe
   * forum_unsubscribe
   * forum_subscribed_users
   * forum_is_forcesubscribed
   * forum_forcesubscribe
   * forum_get_forcesubscribed
   * forum_get_subscribed_forums
   * forum_get_optional_subscribed_forums
   * forum_get_potential_subscribers
 * External function mod_forum_external::get_forum_discussions has been deprecated.
   Use mod_forum_external::get_forum_discussions_paginated instead.

=== 2.6 ===

* The file post_form.php should not be included, the class it contained has
  been moved so that it can benefit from autoloading.
* The function forum_shorten_post() has been deprecated. It was doing a poor
  job of shortening forum post text and the shorten_text() function does a
  much better job.
* The constant FORUM_TRACKING_ON has been deprecated and replaced by
  FORUM_TRACKING_FORCED. The value between them is maintained, so they are
  interchangeable, but code should migrate to the new name.

=== 2.5 ===

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
'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
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.

=== 2.3.5, 2.4.2 ===

* mod/forum:allowforcesubscribe capability will be forcefully assigned to frontpage role, as it was mistakenly missed off
when the capability was initially created. If you don't want users with frontpage role to get forum (with forcesubscribe) emails,
then please remove this capability for frontpage role.
