Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Files | Namespaces | Classes | Functions | Variables
mod_forum

Files

file  access.php
 Plugin capabilities.
 
file  activity.php
 Forum activities search area.
 
file  activity_base.php
 Activity base class.
 
file  assessable_uploaded.php
 The mod_forum assessable uploaded event.
 
file  author.php
 Author vault class.
 
file  author.php
 Author exporter.
 
file  author.php
 Author class.
 
file  author.php
 Author data mapper.
 
file  backup_forum_activity_task.class.php
 Defines backup_forum_activity_task class.
 
file  backup_forum_settingslib.php
 @subpackage backup-moodle2
 
file  backup_forum_stepslib.php
 @subpackage backup-moodle2
 
file  behat_mod_forum.php
 Steps definitions related with the forum activity.
 
file  big_search_form.php
 Big search form.
 
file  builder.php
 Builder factory.
 
file  caches.php
 Defined caches used internally by the plugin.
 
file  capability.php
 Capability manager for the forum.
 
file  cognitive_depth.php
 Cognitive depth indicator - forum.
 
file  container.php
 Container class.
 
file  course_module_instance_list_viewed.php
 The mod_forum instance list viewed event.
 
file  course_module_viewed.php
 The mod_forum course module viewed event.
 
file  course_searched.php
 The mod_forum course searched event.
 
file  coverage.php
 Coverage information for the mod_forum component.
 
file  cron_task.php
 A scheduled task for forum cron.
 
file  cron_trait.php
 The forum module cron trait.
 
file  db_table_vault.php
 Abstract class for loading records from the DB.
 
file  deprecatedlib.php
 
file  discussion.php
 Discussion vault class.
 
file  discussion.php
 Discussion renderer.
 
file  discussion.php
 Discussion exporter class.
 
file  discussion.php
 Discussion class.
 
file  discussion.php
 Discussion data mapper.
 
file  discussion_created.php
 The mod_forum discussion created event.
 
file  discussion_deleted.php
 The mod_forum discussion deleted event.
 
file  discussion_list.php
 Vault class for a discussion list.
 
file  discussion_list.php
 Discussion list renderer.
 
file  discussion_moved.php
 The mod_forum discussion moved event.
 
file  discussion_pinned.php
 The mod_forum discussion pinned event.
 
file  discussion_subscription_created.php
 The mod_forum discussion_subscription created event.
 
file  discussion_subscription_deleted.php
 The mod_forum discussion_subscription deleted event.
 
file  discussion_summaries.php
 Discussion summaries exporter.
 
file  discussion_summary.php
 Discussion summary exporter class.
 
file  discussion_summary.php
 Discussion summary class.
 
file  discussion_unpinned.php
 The mod_forum discussion unpinned event.
 
file  discussion_updated.php
 The mod_forum discussion updated event.
 
file  discussion_viewed.php
 The mod_forum discussion viewed event.
 
file  entity.php
 Entity factory.
 
file  events.php
 Forum event handler definition.
 
file  existing_subscriber_selector.php
 A type of forum.
 
file  export_form.php
 This file contains the form definition for discussion export.
 
file  exported_discussion.php
 Exported discussion builder class.
 
file  exported_discussion_summaries.php
 Exported discussion summaries builder class.
 
file  exported_posts.php
 Exported post builder class.
 
file  exporter.php
 Forum Exporter factory.
 
file  externallib.php
 External forum API.
 
file  extract_context.php
 Extract context vault preprocessor.
 
file  extract_record.php
 Extract record vault preprocessor.
 
file  extract_user.php
 Extract user vault preprocessor.
 
file  forum.php
 Forum vault class.
 
file  forum.php
 Forum Exporter.
 
file  forum.php
 Forum class.
 
file  forum.php
 Forum data mapper.
 
file  forum_gradeitem.php
 Grade item storage for mod_forum.
 
file  forum_post.php
 Forum post renderable.
 
 
file  forumreport.php
 Subplugin info class.
 
file  generator_trait.php
 The forum module trait with additional generator helpers.
 
file  gradeitems.php
 Grade item mappings for the activity.
 
file  group.php
 Course Group exporter.
 
file  legacy_data_mapper.php
 Legacy data mapper factory.
 
file  lib.php
 mod_forum data generator
 
file  lib.php
 
file  lib.php
 Provides support for the conversion of moodle1 backup to the moodle2 format.
 
file  locallib.php
 Library of functions for forum outside of the core api.
 
file  log.php
 Definition of log events.
 
file  manager.php
 Managers factory.
 
file  messageinbound_handlers.php
 Message Inbound Handlers for mod_forum.
 
file  messages.php
 Defines message providers (types of messages being sent)
 
file  mod_form.php
 
file  observer.php
 Event observers used in forum.
 
file  post.php
 Forum posts search area.
 
file  post.php
 Post vault class.
 
file  post.php
 Post exporter class.
 
file  post.php
 Post class.
 
file  post.php
 Post data mapper.
 
file  post_attachment.php
 Post attachment vault class.
 
file  post_created.php
 The mod_forum post created event.
 
file  post_deleted.php
 The mod_forum post deleted event.
 
file  post_form.php
 File containing the form definition to post in the forum.
 
file  post_read_receipt_collection.php
 Post read receipt collection class.
 
file  post_read_receipt_collection.php
 Post read receipt collection class.
 
file  post_updated.php
 The mod_forum post updated event.
 
file  posts.php
 Posts renderer.
 
file  posts.php
 Posts exporter class.
 
file  potential_subscriber_selector.php
 A type of forum.
 
file  provider.php
 Privacy Subsystem implementation for mod_forum.
 
file  prune_form.php
 This file provides form for splitting discussions.
 
file  quick_search_form.php
 Quick search form renderable.
 
file  readtracking_disabled.php
 The mod_forum subscription created event.
 
file  readtracking_enabled.php
 The mod_forum read tracking enabled event.
 
file  refresh_forum_post_counts.php
 Adhoc task that updates all of the existing forum_post records with no wordcount or no charcount.
 
file  renderer.php
 This file contains a custom renderer class used by the forum module.
 
file  renderer.php
 Forum post renderable.
 
file  renderer.php
 Forum post renderable.
 
file  renderer.php
 Forum post renderable.
 
file  renderer.php
 Renderer factory.
 
file  renderer_textemail.php
 Forum post renderable.
 
file  renderer_textemail.php
 Forum post renderable.
 
file  renderer_textemail.php
 Forum post renderable.
 
file  reply_handler.php
 A Handler to process replies to forum posts.
 
file  restore_forum_activity_task.class.php
 @subpackage backup-moodle2
 
file  restore_forum_stepslib.php
 @subpackage backup-moodle2
 
file  rsslib.php
 This file adds support to rss feeds generation.
 
file  send_user_digests.php
 This file defines an adhoc task to send notifications.
 
file  send_user_notifications.php
 This file defines an adhoc task to send notifications.
 
file  services.php
 Forum external functions and service definitions.
 
file  settings.php
 
file  social_breadth.php
 Social breadth indicator - forum.
 
file  sorter.php
 Class to sort items.
 
file  subcontext_info.php
 Privacy Subsystem implementation for mod_forum.
 
file  subscriber_selector_base.php
 A type of forum.
 
file  subscribers_viewed.php
 The mod_forum subscribers list viewed event.
 
file  subscription_created.php
 The mod_forum subscription created event.
 
file  subscription_deleted.php
 The mod_forum subscription deleted event.
 
file  subscriptions.php
 Forum subscription manager.
 
file  tag.php
 Tag areas in component mod_forum.
 
file  tasks.php
 Definition of Forum scheduled tasks.
 
file  upgrade.php
 This file keeps track of upgrades to the forum module.
 
file  url.php
 A URL factory for the forum.
 
file  user_report_viewed.php
 The mod_forum user report viewed event.
 
file  vault.php
 Vault factory.
 
file  version.php
 Version information.
 

Namespaces

 mod_forum
  
 
 mod_forum\analytics\indicator
  
 
 mod_forum\event
  
 
 mod_forum\form
  
 
 mod_forum\grades
  
 
 mod_forum\local
  
 
 mod_forum\local\builders
  
 
 mod_forum\local\data_mappers\legacy
  
 
 mod_forum\local\entities
  
 
 mod_forum\local\exporters
  
 
 mod_forum\local\factories
  
 
 mod_forum\local\managers
  
 
 mod_forum\local\renderers
  
 
 mod_forum\local\vaults
  
 
 mod_forum\local\vaults\preprocessors
  
 
 mod_forum\message\inbound
  
 
 mod_forum\output
  
 
 mod_forum\output\email
  
 
 mod_forum\output\emaildigestbasic
  
 
 mod_forum\output\emaildigestfull
  
 
 mod_forum\plugininfo
  
 
 mod_forum\privacy
  
 
 mod_forum\search
  
 
 mod_forum\task
  
 

Classes

class  backup_forum_activity_structure_step
 Define all the backup steps that will be used by the backup_forum_activity_task. More...
 
class  backup_forum_activity_task
 Provides the steps to perform one complete backup of the Forum instance. More...
 
class  behat_mod_forum
 
class  forum_file_info_container
 
class  forum_portfolio_caller
 
class  mod_forum\analytics\indicator\activity_base
 Activity base class. More...
 
class  mod_forum\analytics\indicator\cognitive_depth
 Cognitive depth indicator - forum. More...
 
class  mod_forum\analytics\indicator\social_breadth
 Social breadth indicator - forum. More...
 
class  mod_forum\event\assessable_uploaded
 
class  mod_forum\event\course_module_instance_list_viewed
 The mod_forum instance list viewed event class. More...
 
class  mod_forum\event\course_module_viewed
 The mod_forum course module viewed event class. More...
 
class  mod_forum\event\course_searched
 
class  mod_forum\event\discussion_created
 
class  mod_forum\event\discussion_deleted
 
class  mod_forum\event\discussion_moved
 
class  mod_forum\event\discussion_pinned
 The mod_forum discussion pinned event. More...
 
class  mod_forum\event\discussion_subscription_created
 
class  mod_forum\event\discussion_subscription_deleted
 
class  mod_forum\event\discussion_unpinned
 The mod_forum discussion unpinned event. More...
 
class  mod_forum\event\discussion_updated
 
class  mod_forum\event\discussion_viewed
 The mod_forum discussion viewed event class. More...
 
class  mod_forum\event\post_created
 
class  mod_forum\event\post_deleted
 
class  mod_forum\event\post_updated
 
class  mod_forum\event\readtracking_disabled
 
class  mod_forum\event\readtracking_enabled
 
class  mod_forum\event\subscribers_viewed
 
class  mod_forum\event\subscription_created
 
class  mod_forum\event\subscription_deleted
 
class  mod_forum\event\user_report_viewed
 
class  mod_forum\form\export_form
 Export discussion form. More...
 
class  mod_forum\grades\forum_gradeitem
 Grade item storage for mod_forum. More...
 
class  mod_forum\grades\gradeitems
 Grade item mappings for the activity. More...
 
class  mod_forum\local\builders\exported_discussion
 Exported discussion builder class. More...
 
class  mod_forum\local\builders\exported_discussion_summaries
 Exported discussion summaries builder class. More...
 
class  mod_forum\local\builders\exported_posts
 Exported post builder class. More...
 
class  mod_forum\local\container
 Container class. More...
 
class  mod_forum\local\data_mappers\legacy\author
 Convert an author entity into an stdClass. More...
 
class  mod_forum\local\data_mappers\legacy\discussion
 Convert a discussion entity into an stdClass. More...
 
class  mod_forum\local\data_mappers\legacy\forum
 Convert a forum entity into an stdClass. More...
 
class  mod_forum\local\data_mappers\legacy\post
 Convert a post entity into an stdClass. More...
 
class  mod_forum\local\entities\author
 Author class. More...
 
class  mod_forum\local\entities\discussion
 Discussion class. More...
 
class  mod_forum\local\entities\discussion_summary
 Discussion summary class. More...
 
class  mod_forum\local\entities\forum
 Forum class. More...
 
class  mod_forum\local\entities\post
 Post class. More...
 
class  mod_forum\local\entities\post_read_receipt_collection
 Post read receipt collection class. More...
 
class  mod_forum\local\entities\sorter
 Class to sort lists of items. More...
 
class  mod_forum\local\exporters\author
 Author exporter. More...
 
class  mod_forum\local\exporters\discussion
 Discussion exporter class. More...
 
class  mod_forum\local\exporters\discussion_summaries
 Discussion summaries exporter. More...
 
class  mod_forum\local\exporters\discussion_summary
 Discussion summary exporter class. More...
 
class  mod_forum\local\exporters\forum
 Forum class. More...
 
class  mod_forum\local\exporters\group
 Group exporter. More...
 
class  mod_forum\local\exporters\post
 Post exporter class. More...
 
class  mod_forum\local\exporters\posts
 Posts exporter class. More...
 
class  mod_forum\local\factories\builder
 Builder factory to construct any builders for forum. More...
 
class  mod_forum\local\factories\entity
 Entity factory to create the forum entities. More...
 
class  mod_forum\local\factories\exporter
 The exporter factory class used to fetch an instance of the different exporter types. More...
 
class  mod_forum\local\factories\legacy_data_mapper
 Legacy data mapper factory. More...
 
class  mod_forum\local\factories\manager
 Managers factory. More...
 
class  mod_forum\local\factories\renderer
 Renderer factory. More...
 
class  mod_forum\local\factories\url
 A URL factory for the forum. More...
 
class  mod_forum\local\factories\vault
 Vault factory. More...
 
class  mod_forum\local\managers\capability
 Capability manager for the forum. More...
 
class  mod_forum\local\renderers\discussion
 Discussion renderer class. More...
 
class  mod_forum\local\renderers\discussion_list
 The discussion list renderer. More...
 
class  mod_forum\local\renderers\posts
 Posts renderer class. More...
 
class  mod_forum\local\vaults\author
 Author vault class. More...
 
class  mod_forum\local\vaults\db_table_vault
 Abstract class for loading records from the DB. More...
 
class  mod_forum\local\vaults\discussion
 Discussion vault class. More...
 
class  mod_forum\local\vaults\discussion_list
 Discussion list vault. More...
 
class  mod_forum\local\vaults\forum
 Forum vault class. More...
 
class  mod_forum\local\vaults\post
 Post vault class. More...
 
class  mod_forum\local\vaults\post_attachment
 Post attachment vault class. More...
 
class  mod_forum\local\vaults\post_read_receipt_collection
 Post read receipt collection class. More...
 
class  mod_forum\local\vaults\preprocessors\extract_context
 Extract context vault preprocessor. More...
 
class  mod_forum\local\vaults\preprocessors\extract_record
 Extract record vault preprocessor. More...
 
class  mod_forum\local\vaults\preprocessors\extract_user
 Extract user vault preprocessor. More...
 
class  mod_forum\message\inbound\reply_handler
 A Handler to process replies to forum posts. More...
 
class  mod_forum\output\big_search_form
 Big search form class. More...
 
class  mod_forum\output\email\renderer
 Forum post renderable. More...
 
class  mod_forum\output\email\renderer_textemail
 Forum post renderable. More...
 
class  mod_forum\output\emaildigestbasic\renderer
 Forum post renderable. More...
 
class  mod_forum\output\emaildigestbasic\renderer_textemail
 Forum post renderable. More...
 
class  mod_forum\output\emaildigestfull\renderer
 Forum post renderable. More...
 
class  mod_forum\output\emaildigestfull\renderer_textemail
 Forum post renderable. More...
 
class  mod_forum\output\forum_post
 
class  mod_forum\output\forum_post_email
 Forum post renderable for use in e-mail. More...
 
class  mod_forum\output\quick_search_form
 Quick search form renderable class. More...
 
class  mod_forum\plugininfo\forumreport
 Forum report subplugin info class. More...
 
class  mod_forum\privacy\provider
 Implementation of the privacy subsystem plugin provider for the forum activity module. More...
 
class  mod_forum\search\activity
 Forum activities search area. More...
 
class  mod_forum\search\post
 Forum posts search area. More...
 
class  mod_forum\subscriptions
 Forum subscription manager. More...
 
class  mod_forum\task\cron_task
 The main scheduled task for the forum. More...
 
class  mod_forum\task\refresh_forum_post_counts
 Adhoc task that updates all of the existing forum_post records with no wordcount or no charcount. More...
 
class  mod_forum\task\send_user_digests
 Adhoc task to send moodle forum digests for the specified user. More...
 
class  mod_forum\task\send_user_notifications
 Adhoc task to send user forum notifications. More...
 
class  mod_forum_existing_subscriber_selector
 User selector control for removing subscribed users. More...
 
class  mod_forum_external
 
class  mod_forum_generator
 
class  mod_forum_mod_form
 
class  mod_forum_observer
 Event observer for mod_forum. More...
 
class  mod_forum_post_form
 Class to post in a forum. More...
 
class  mod_forum_potential_subscriber_selector
 A user selector control for potential subscribers to the selected forum. More...
 
class  mod_forum_prune_form
 Form which displays fields for splitting forum post to a separate threads. More...
 
class  mod_forum_renderer
 A custom renderer class that extends the plugin_renderer_base and is used by the forum module. More...
 
class  mod_forum_subscriber_selector_base
 Abstract class used by forum subscriber selection controls. More...
 
class  moodle1_mod_forum_handler
 Forum conversion handler. More...
 
class  phpunit_coverage_info
 Coverage information for the tool_dataprivacy plugin. More...
 
class  restore_forum_activity_structure_step
 Define all the restore steps that will be used by the restore_forum_activity_task. More...
 
class  restore_forum_activity_task
 forum restore task that provides all the settings and steps to perform one complete restore of the activity More...
 

Functions

object forum_add_attachment ($post, $forum, $cm, $mform=null, $unused=null)
 If successful, this function returns the name of the file. More...
 
 forum_add_discussion ($discussion, $mform=null, $unused=null, $userid=null)
 Given an object containing all the necessary data, create a new discussion and return the id. More...
 
 forum_add_instance ($forum, $mform=null)
 STANDARD FUNCTIONS ///////////////////////////////////////////////////////////. More...
 
 forum_add_new_post ($post, $mform, $unused=null)
 Add a new post in an existing discussion. More...
 
 forum_can_create_attachment ($forum, $context)
 Check if the user can create attachments in a forum. More...
 
object forum_change_discussionid ($postid, $discussionid)
 recursively sets the discussion field to $discussionid on $postid and all its children used when pruning a post More...
 
 forum_check_blocking_threshold ($thresholdwarning)
 Throws an error if the user is no longer allowed to post due to having reached or exceeded the number of posts specified in 'Post threshold for blocking' setting. More...
 
 forum_check_throttling ($forum, $cm=null)
 Returns a warning object if a user has reached the number of posts equal to the warning/blocking setting, or false if there is no warning to show. More...
 
 forum_check_updates_since (cm_info $cm, $from, $filter=array())
 Check if the module has any update that affects the current user since a given time. More...
 
 forum_cm_info_view (cm_info $cm)
 Adds information about unread messages, that is only required for the course view page (and similar), to the course-module object. More...
 
 forum_convert_to_roles ()
 
 forum_count_discussion_replies ($forumid, $forumsort="", $limit=-1, $page=-1, $perpage=0, $canseeprivatereplies=false)
 Returns an array of counts of replies to each discussion. More...
 
object forum_count_discussions ($forum, $cm, $course)
 @global object @global object @staticvar array $cache More...
 
 forum_count_replies ($post, $children=true)
 Count the number of replies to the specified post. More...
 
 forum_count_unrated_posts ()
 
object forum_count_user_posts ($forumid, $userid)
 Get all the posts for a user in a forum suitable for forum_print_post. More...
 
 forum_cron ()
 Function to be run periodically according to the scheduled task. More...
 
 forum_cron_minimise_user_record (stdClass $user)
 Removes properties from user record that are not necessary for sending post notifications. More...
 
object forum_delete_discussion ($discussion, $fulldelete, $course, $cm, $forum)
 Deletes a discussion and handles all associated cleanup. More...
 
object forum_delete_instance ($id)
 Given an ID of an instance of this module, this function will permanently delete the instance and any data that depends on it. More...
 
object forum_delete_post ($post, $children, $course, $cm, $forum, $skipcompletion=false)
 Deletes a single forum post. More...
 
 forum_discussion_is_locked ($forum, $discussion)
 Determine whether the specified discussion is time-locked. More...
 
 forum_discussion_pin ($modcontext, $forum, $discussion)
 Set the discussion to pinned and trigger the discussion pinned event. More...
 
 forum_discussion_unpin ($modcontext, $forum, $discussion)
 Set discussion to unpinned and trigger the discussion unpin event. More...
 
object forum_discussion_update_last_post ($discussionid)
 Sets the last post for a given discussion. More...
 
 forum_discussion_view ($modcontext, $forum, $discussion)
 Trigger the discussion viewed event. More...
 
object forum_discussions_user_has_posted_in ($forumid, $userid)
 @global object More...
 
 forum_extend_settings_navigation (settings_navigation $settingsnav, navigation_node $forumnode)
 Adds module specific settings to the settings block. More...
 
 forum_filter_user_groups_discussions ()
 
 forum_forcesubscribe ($forumid, $value=1)
 
 forum_get_all_discussion_posts ($discussionid, $sort, $tracking=false)
 Gets all posts in discussion including top parent. More...
 
 forum_get_child_posts ()
 
object forum_get_completion_state ($course, $cm, $userid, $type)
 Obtains the automatic completion state for this forum based on any conditions in forum settings. More...
 
 forum_get_context ($forumid, $context=null)
 Determine the current context if one was not already specified. More...
 
object forum_get_course_forum ($courseid, $type)
 @global object More...
 
 forum_get_coursemodule_info ($coursemodule)
 Add a get_coursemodule_info function in case any forum type wants to add 'extra' information for the course (see resource). More...
 
moodle_database forum_get_courses_user_posted_in ($user, $discussionsonly=false, $includecontexts=true, $limitfrom=null, $limitnum=null)
 Gets all of the courses where the provided user has posted in a forum. More...
 
 forum_get_default_sort_order ($desc=true, $compare='d.timemodified', $prefix='d', $pinned=true)
 Get the sql to use in the ORDER BY clause for forum discussions. More...
 
 forum_get_discussion_neighbours ($cm, $discussion, $forum)
 Gets the neighbours (previous and next) of a discussion. More...
 
 forum_get_discussion_posts ()
 
 forum_get_discussion_subscription_icon ($forum, $discussionid, $returnurl=null, $includetext=false)
 Return the markup for the discussion subscription toggling icon. More...
 
 forum_get_discussion_subscription_icon_preloaders ()
 Return a pair of spans containing classes to allow the subscribe and unsubscribe icons to be pre-loaded by a browser. More...
 
object forum_get_discussions ($cm, $forumsort="", $fullpost=true, $unused=-1, $limit=-1, $userlastmodified=false, $page=-1, $perpage=0, $groupid=-1, $updatedsince=0)
 Get all discussions in a forum. More...
 
object forum_get_discussions_count ($cm)
 @global object @global object @uses CONEXT_MODULE @uses VISIBLEGROUPS More...
 
object forum_get_discussions_unread ($cm)
 @global object @global object @uses CONTEXT_MODULE @uses VISIBLEGROUPS More...
 
 forum_get_email_message_id ($postid, $usertoid)
 Create a message-id string to use in the custom headers of forum notification emails. More...
 
 forum_get_extra_capabilities ()
 Returns all other caps used in module. More...
 
 forum_get_file_areas ($course, $cm, $context)
 
 forum_get_file_info ($browser, $areas, $course, $cm, $context, $filearea, $itemid, $filepath, $filename)
 
object forum_get_firstpost_from_discussion ($discussionid)
 Given a discussion id, return the first post from the discussion. More...
 
 forum_get_forcesubscribed ($forum)
 
 forum_get_forum_types ()
 Returns array of forum types chooseable on the forum editing form. More...
 
 forum_get_forum_types_all ()
 Returns array of all forum layout modes. More...
 
moodle_database forum_get_forums_user_posted_in ($user, array $courseids=null, $discussionsonly=false, $limitfrom=null, $limitnum=null)
 Gets all of the forums a user has posted in for one or more courses. More...
 
 forum_get_layout_modes (bool $useexperimentalui=false)
 Returns array of forum layout modes. More...
 
 forum_get_open_modes ()
 
 forum_get_optional_subscribed_forums ()
 
 forum_get_post_actions ()
 List the actions that correspond to a post of this module. More...
 
object forum_get_post_from_log ($log)
 Given a log entry, return the forum post details for it. More...
 
object forum_get_post_full ($postid)
 Gets a post with all info ready for forum_print_post Most of these joins are just to get the forum id. More...
 
moodle_database forum_get_posts_by_user ($user, array $courses, $musthaveaccess=false, $discussionsonly=false, $limitfrom=0, $limitnum=50)
 Returns posts made by the selected user in the requested courses. More...
 
 forum_get_potential_subscribers ()
 
 forum_get_ratings ()
 
object forum_get_readable_forums ($userid, $courseid=0)
 An array of forum objects that the user is allowed to read/search through. More...
 
object forum_get_recent_mod_activity (&$activities, &$index, $timestart, $courseid, $cmid, $userid=0, $groupid=0)
 Returns all forum posts since a given time in specified forum. More...
 
 forum_get_subscribe_link ($forum, $context, $messages=array(), $cantaccessagroup=false, $unused1=true, $backtoindex=false, $unused2=null)
 Generate and return the subscribe or unsubscribe link for a forum. More...
 
 forum_get_subscribed_forums ()
 
 forum_get_subscriptionmode_options ()
 List the options for forum subscription modes. More...
 
 forum_get_tracking_link ()
 
 forum_get_user_digest_options ($user=null)
 Retrieve the list of available user digest options. More...
 
 forum_get_user_discussions ()
 
 forum_get_user_grades ($forum, $userid=0)
 Return grade for given user or all users. More...
 
object forum_get_user_involved_discussions ($forumid, $userid)
 Get all the discussions user participated in. More...
 
 forum_get_user_maildigest_bulk ($digests, $user, $forumid)
 Determine the maildigest setting for the specified user against the specified forum. More...
 
object forum_get_user_posted_time ($did, $userid)
 Returns creation time of the first user's post in given discussion $DB. More...
 
object forum_get_user_posts ($forumid, $userid)
 Get all the posts for a user in a forum suitable for forum_print_post. More...
 
 forum_get_view_actions ()
 List the actions that correspond to a view of this module. More...
 
object forum_go_back_to ($default)
 
 forum_grade_item_delete ($forum)
 Delete grade item for given forum. More...
 
 forum_grade_item_update ($forum, $ratings=null, $forumgrades=null)
 Create/update grade items for given forum. More...
 
 forum_grading_areas_list ()
 Lists all gradable areas for the advanced grading methods gramework. More...
 
 forum_instance_created ($context, $forum)
 Handle changes following the creation of a forum instance. More...
 
 forum_is_author_hidden ($post, $forum)
 Checks whether the author's name and picture for a given post should be hidden or not. More...
 
 forum_is_cutoff_date_reached ($forum)
 Determine whether the specified forum's cutoff date is reached. More...
 
 forum_is_due_date_reached ($forum)
 Determine whether the specified forum's due date is reached. More...
 
 forum_is_forcesubscribed ($forum)
 Determine whether the forum is force subscribed. More...
 
 forum_is_subscribed ()
 
 forum_is_user_group_discussion (cm_info $cm, $discussiongroupid)
 Returns whether the discussion group is visible by the current user or not. More...
 
 forum_make_mail_html ($course, $cm, $forum, $discussion, $post, $userfrom, $userto, $replyaddress=null)
 Builds and returns the body of the email notification in html format. More...
 
 forum_make_mail_post ($course, $cm, $forum, $discussion, $post, $userfrom, $userto, $ownpost=false, $reply=false, $link=false, $rate=false, $footer="")
 Given the data about a posting, builds up the HTML to display it and returns the HTML in a string. More...
 
 forum_make_mail_text ($course, $cm, $forum, $discussion, $post, $userfrom, $userto, $bare=false, $replyaddress=null)
 Builds and returns the body of the email notification in plain text. More...
 
object forum_move_attachments ($discussion, $forumfrom, $forumto)
 Given a discussion object that is being moved to $forumto, this function checks all posts in that discussion for attachments, and if any are found, these are moved to the new forum directory. More...
 
 forum_page_type_list ($pagetype, $parentcontext, $currentcontext)
 Return a list of page types. More...
 
 forum_pluginfile ($course, $cm, $context, $filearea, $args, $forcedownload, array $options=array())
 
 forum_post_is_visible_privately ($post, $cm)
 Check whether the forum post is a private reply visible to this user. More...
 
 forum_post_nesting_cache ()
 Return a static array of posts that are open. More...
 
 forum_post_subscription ($fromform, $forum, $discussion)
 Given a new post, subscribes or unsubscribes as appropriate. More...
 
object forum_print_attachments ($post, $cm, $type)
 Returns attachments as formated text/html optionally with separate images. More...
 
 forum_print_discussion ($course, $cm, $forum, $discussion, $post, $mode, $canreply=NULL, $canrate=false)
 Prints a forum discussion. More...
 
object forum_print_discussion_header (&$post, $forum, $group=-1, $datestring="", $cantrack=true, $forumtracked=true, $canviewparticipants=true, $modcontext=null, $canviewhiddentimedposts=false)
 This function prints the overview of a discussion in the forum listing. More...
 
 forum_print_latest_discussions ($course, $forum, $maxdiscussions=-1, $displayformat='plain', $sort='', $currentgroup=-1, $groupmode=-1, $page=-1, $perpage=100, $cm=null)
 Prints the discussion view screen for a forum. More...
 
 forum_print_mode_form ($id, $mode, $forumtype='')
 Print the drop down that allows the user to select how they want to have the discussion displayed. More...
 
 forum_print_overview ()
 
object forum_print_post ($post, $discussion, $forum, &$cm, $course, $ownpost=false, $reply=false, $link=false, $footer="", $highlight="", $postisread=null, $dummyifcantsee=true, $istracked=null, $return=false)
 Print a forum post This function should always be surrounded with calls to forum_print_post_start and forum_print_post_end to create the surrounding container for the post. More...
 
 forum_print_post_end ($post, $return=false)
 End a forum post container. More...
 
 forum_print_post_start ($post, $return=false)
 Start a forum post container. More...
 
object forum_print_posts_flat ($course, &$cm, $forum, $discussion, $post, $mode, $reply, $forumtracked, $posts)
 @global object @uses FORUM_MODE_FLATNEWEST More...
 
object forum_print_posts_nested ($course, &$cm, $forum, $discussion, $parent, $reply, $forumtracked, $posts)
 
object forum_print_posts_threaded ($course, &$cm, $forum, $discussion, $parent, $depth, $reply, $forumtracked, $posts)
 
object forum_print_recent_activity ($course, $viewfullnames, $timestart)
 Given a course and a date, prints a summary of all the new messages posted in the course since that date. More...
 
 forum_print_recent_mod_activity ($activity, $courseid, $detail, $modnames, $viewfullnames)
 Outputs the forum post indicated by $activity. More...
 
 forum_rating_permissions ($contextid, $component, $ratingarea)
 Return rating related permissions. More...
 
 forum_rating_validate ($params)
 Validates a submitted rating. More...
 
 forum_reset_course_form_defaults ($course)
 Course reset form defaults. More...
 
 forum_reset_course_form_definition (&$mform)
 Called by course/reset.php. More...
 
object forum_reset_gradebook ($courseid, $type='')
 Removes all grades from gradebook. More...
 
object forum_reset_userdata ($data)
 This function is used by the reset_course_userdata function in moodlelib. More...
 
 forum_rss_delete_file ($forum)
 Given a forum object, deletes all cached RSS files associated with it. More...
 
 forum_rss_feed_contents ($forum, $sql, $params, $context)
 This function return the XML rss contents about the forum It returns false if something is wrong. More...
 
 forum_rss_feed_discussions_sql ($forum, $cm, $newsince=0)
 Generates the SQL query used to get the Discussion details from the forum table of the database. More...
 
 forum_rss_feed_posts_sql ($forum, $cm, $newsince=0)
 Generates the SQL query used to get the Post details from the forum table of the database. More...
 
 forum_rss_get_feed ($context, $args)
 Returns the path to the cached rss feed contents. More...
 
 forum_rss_get_group_sql ($cm, $groupmode, $currentgroup, $modcontext=null)
 Retrieve the correct SQL snippet for group-only forums. More...
 
 forum_rss_get_sql ($forum, $cm, $time=0)
 Determines which type of SQL query is required, one for posts or one for discussions, and returns the appropriate query. More...
 
 forum_rss_newstuff ($forum, $cm, $time)
 If there is new stuff in the forum since $time this returns true Otherwise it returns false. More...
 
 forum_scale_used ()
 
 forum_scale_used_anywhere (int $scaleid)
 Checks if scale is being used by any instance of forum. More...
 
object forum_search_form ($course, $search='')
 
object forum_search_posts ($searchterms, $courseid=0, $limitfrom=0, $limitnum=50, &$totalcount, $extrasql='')
 Returns a list of posts found using an array of search terms. More...
 
object forum_set_return ()
 @global object
 
 forum_set_user_maildigest ($forum, $maildigest, $user=null)
 Set the per-forum maildigest option for the specified user. More...
 
 forum_shorten_post ($message)
 
 forum_should_end_post_nesting ($id)
 Return true when all the opens are nested with a close. More...
 
 forum_should_start_post_nesting ($id)
 Return true for the first time this post was started. More...
 
 forum_subscribe ()
 
 forum_subscribed_users ()
 
 forum_supports ($feature)
 Indicates API features that the forum supports. More...
 
object forum_tp_add_read_record ($userid, $postid)
 Mark post as read. More...
 
object forum_tp_can_track_forums ($forum=false, $user=false)
 Determine if a user can track forums and optionally a particular forum. More...
 
object forum_tp_clean_read_records ()
 Clean old records from the forum_read table. More...
 
 forum_tp_count_discussion_read_records ()
 
 forum_tp_count_discussion_unread_posts ()
 
 forum_tp_count_forum_posts ()
 
 forum_tp_count_forum_read_records ()
 
object forum_tp_count_forum_unread_posts ($cm, $course, $resetreadcache=false)
 Returns the count of records for the provided user and forum and [optionally] group. More...
 
object forum_tp_delete_read_records ($userid=-1, $postid=-1, $discussionid=-1, $forumid=-1)
 Deletes read records for the specified index. More...
 
object forum_tp_get_course_unread_posts ($userid, $courseid)
 Returns the count of records for the provided user and course. More...
 
 forum_tp_get_discussion_read_records ()
 
 forum_tp_get_read_records ()
 
object forum_tp_get_untracked_forums ($userid, $courseid)
 Get a list of forums not tracked by the user. More...
 
object forum_tp_is_post_old ($post, $time=null)
 
object forum_tp_is_post_read ($userid, $post)
 
object forum_tp_is_tracked ($forum, $user=false)
 Tells whether a specific forum is tracked by the user. More...
 
object forum_tp_mark_discussion_read ($user, $discussionid)
 Marks a whole discussion as read, for a given user. More...
 
object forum_tp_mark_forum_read ($user, $forumid, $groupid=false)
 Marks a whole forum as read, for a given user. More...
 
 forum_tp_mark_post_read ($userid, $post, $unused=null)
 If its an old post, do nothing. More...
 
object forum_tp_mark_posts_read ($user, $postids)
 Mark posts as read. More...
 
object forum_tp_start_tracking ($forumid, $userid=false)
 @global object More...
 
object forum_tp_stop_tracking ($forumid, $userid=false)
 @global object More...
 
 forum_trigger_content_uploaded_event ($post, $cm, $name)
 Sends post content to plagiarism plugin. More...
 
 forum_trigger_post_updated_event ($post, $discussion, $context, $forum)
 Trigger post updated event. More...
 
 forum_unsubscribe ()
 
 forum_update_calendar ($forum, $cmid)
 Update the calendar entries for this forum activity. More...
 
 forum_update_grades ($forum, $userid=0)
 Update activity grades. More...
 
object forum_update_instance ($forum, $mform)
 Given an object containing all the necessary data, (defined by the form in mod_form.php) this function will update an existing instance with new data. More...
 
 forum_update_post ($newpost, $mform, $unused=null)
 Update a post. More...
 
object forum_update_subscriptions_button ($courseid, $forumid)
 Prints the editing button on subscribers page. More...
 
object forum_user_can_post ($forum, $discussion, $user=NULL, $cm=NULL, $course=NULL, $context=NULL)
 This function checks whether the user can reply to posts in a forum discussion. More...
 
object forum_user_can_post_discussion ($forum, $currentgroup=null, $unused=-1, $cm=NULL, $context=NULL)
 
 forum_user_can_reply_privately (\context_module $context, stdClass $parent)
 Check whether the user can reply privately to the parent post. More...
 
object forum_user_can_see_discussion ($forum, $discussion, $context, $user=NULL)
 @global object @uses DEBUG_DEVELOPER More...
 
 forum_user_can_see_group_discussion ($discussion, $cm, $context)
 Check to ensure a user can view a group discussion. More...
 
 forum_user_can_see_post ($forum, $discussion, $post, $user=null, $cm=null, $checkdeleted=true)
 Check whether a user can see the specified post. More...
 
 forum_user_can_see_timed_discussion ($discussion, $user, $context)
 Check to ensure a user can view a timed discussion. More...
 
 forum_user_can_view_post ()
 
object forum_user_complete ($course, $user, $mod, $forum)
 @global object More...
 
 forum_user_enrolled ()
 
object forum_user_has_posted ($forumid, $did, $userid)
 @global object More...
 
 forum_user_has_posted_discussion ($forumid, $userid, $groupid=null)
 Returns true if user created new discussion already. More...
 
 forum_user_outline ($course, $user, $mod, $forum)
 
 forum_view ($forum, $course, $cm, $context)
 Mark the activity completed (if required) and trigger the course_module_viewed event. More...
 
 mod_forum_core_calendar_event_action_shows_item_count (calendar_event $event, $itemcount=0)
 Callback function that determines whether an action event should be showing its item count based on the event type and the item count. More...
 
 mod_forum_core_calendar_event_timestart_updated (\calendar_event $event, stdClass $forum)
 This function will update the forum module according to the event that has been modified. More...
 
 mod_forum_core_calendar_get_valid_event_timestart_range (\calendar_event $event, stdClass $forum)
 This function calculates the minimum and maximum cutoff values for the timestart of the given event. More...
 
 mod_forum_core_calendar_provide_event_action (calendar_event $event, core_calendar\action_factory $factory, int $userid=0)
 This function receives a calendar event and returns the action associated with it, or null if there is none. More...
 
 mod_forum_count_all_discussions (\mod_forum\local\entities\forum $forum, stdClass $user, ?int $groupid)
 Get a count of all discussions in a forum. More...
 
 mod_forum_get_completion_active_rule_descriptions ($cm)
 Callback which returns human-readable strings describing the active completion custom rules for the module instance. More...
 
 mod_forum_get_discussion_summaries (\mod_forum\local\entities\forum $forum, stdClass $user, ?int $groupid, ?int $sortorder, ?int $pageno=0, ?int $pagesize=0)
 Fetch the data used to display the discussions on the current page. More...
 
 mod_forum_get_fontawesome_icon_map ()
 Get icon mapping for font-awesome. More...
 
 mod_forum_get_groups_from_groupid (\mod_forum\local\entities\forum $forum, stdClass $user, ?int $groupid)
 Get the list of groups to show based on the current user and requested groupid. More...
 
 mod_forum_get_tagged_posts ($tag, $exclusivemode=false, $fromctx=0, $ctx=0, $rec=1, $page=0)
 Returns forum posts tagged with a specified tag. More...
 
 mod_forum_inplace_editable ($itemtype, $itemid, $newvalue)
 Manage inplace editable saves. More...
 
 mod_forum_myprofile_navigation (core_user\output\myprofile\tree $tree, $user, $iscurrentuser, $course)
 Add nodes to myprofile page. More...
 
 mod_forum_rating_can_see_item_ratings ($params)
 Can the current user see ratings for a given itemid? More...
 
 mod_forum_user_preferences ()
 Return a list of all the user preferences used by mod_forum. More...
 
 xmldb_forum_upgrade ($oldversion)
 

Variables

 $capabilities
 
global mod_forum\local\entities::$CFG
 
global mod_forum\local\factories::$CFG
 
global $DB
 
 $definitions
 
 $functions
 
 $handlers
 
 $logs
 
 $messageproviders
 
 $observers
 
 $tagareas
 
 $tasks
 
$plugin component = 'mod_forum'
 
const FORUM_CHOOSESUBSCRIBE 0
 
const FORUM_DISALLOWSUBSCRIBE 3
 
const FORUM_DISCUSSION_PINNED 1
 
const FORUM_DISCUSSION_UNPINNED 0
 
const FORUM_EVENT_TYPE_DUE 'due'
 
const FORUM_FORCESUBSCRIBE 1
 
const FORUM_INITIALSUBSCRIBE 2
 
const FORUM_MAILED_ERROR 2
 
const FORUM_MAILED_PENDING 0
 
const FORUM_MAILED_SUCCESS 1
 
const FORUM_MODE_FLATNEWEST -1
 
const FORUM_MODE_FLATOLDEST 1
 Include required files. More...
 
const FORUM_MODE_NESTED 3
 
const FORUM_MODE_NESTED_V2 4
 
const FORUM_MODE_THREADED 2
 
const FORUM_POSTS_ALL_USER_GROUPS (!defined('FORUM_CRON_USER_CACHE')) -2
 FORUM_POSTS_ALL_USER_GROUPS - All the posts in groups where the user is enrolled.
 
const FORUM_TRACKING_FORCED 2
 FORUM_TRACKING_FORCED - Tracking is on, regardless of user setting. More...
 
const FORUM_TRACKING_OFF 0
 FORUM_TRACKING_OFF - Tracking is not available for this forum.
 
const FORUM_TRACKING_ON 2
 FORUM_TRACKING_ON - deprecated alias for FORUM_TRACKING_FORCED. More...
 
const FORUM_TRACKING_OPTIONAL 1
 FORUM_TRACKING_OPTIONAL - Tracking is based on user preference.
 
 if (!defined( 'MOODLE_INTERNAL'))
 
 if (!defined( 'MOODLE_INTERNAL'))
 
$plugin requires = 2019111200
 
$plugin version = 2019111802
 

Detailed Description

Function Documentation

◆ forum_add_attachment()

object forum_add_attachment (   $post,
  $forum,
  $cm,
  $mform = null,
  $unused = null 
)

If successful, this function returns the name of the file.

Parameters
object$postis a full post record, including course and forum
object$forum
object$cm
mixed$mform
string$unused
Return values
bool

◆ forum_add_discussion()

forum_add_discussion (   $discussion,
  $mform = null,
  $unused = null,
  $userid = null 
)

Given an object containing all the necessary data, create a new discussion and return the id.

Parameters
object$post
mixed$mform
string$unused
int$userid
Return values
object

◆ forum_add_instance()

forum_add_instance (   $forum,
  $mform = null 
)

STANDARD FUNCTIONS ///////////////////////////////////////////////////////////.

Given an object containing all the necessary data, (defined by the form in mod_form.php) this function will create a new instance and return the id number of the new instance.

Parameters
stdClass$forumadd forum instance
mod_forum_mod_form$mform
Return values
intintance id

◆ forum_add_new_post()

forum_add_new_post (   $post,
  $mform,
  $unused = null 
)

Add a new post in an existing discussion.

Parameters
stdClass$postThe post data
mixed$mformThe submitted form
string$unused
Return values
int

◆ forum_can_create_attachment()

forum_can_create_attachment (   $forum,
  $context 
)

Check if the user can create attachments in a forum.

Parameters
stdClass$forumforum object
stdClass$contextcontext object
Return values
booltrue if the user can create attachments, false otherwise
Since
Moodle 3.3

◆ forum_change_discussionid()

object forum_change_discussionid (   $postid,
  $discussionid 
)

recursively sets the discussion field to $discussionid on $postid and all its children used when pruning a post

Parameters
int$postid
int$discussionid
Return values
bool

◆ forum_check_blocking_threshold()

forum_check_blocking_threshold (   $thresholdwarning)

Throws an error if the user is no longer allowed to post due to having reached or exceeded the number of posts specified in 'Post threshold for blocking' setting.

Since
Moodle 2.5
Parameters
stdClass$thresholdwarningthe warning information returned from the function forum_check_throttling.

◆ forum_check_throttling()

forum_check_throttling (   $forum,
  $cm = null 
)

Returns a warning object if a user has reached the number of posts equal to the warning/blocking setting, or false if there is no warning to show.

Parameters
int | stdClass$forumthe forum id or the forum object
stdClass$cmthe course module
Return values
stdClass|boolreturns an object with the warning information, else returns false if no warning is required.

◆ forum_check_updates_since()

forum_check_updates_since ( cm_info  $cm,
  $from,
  $filter = array() 
)

Check if the module has any update that affects the current user since a given time.

Parameters
cm_info$cmcourse module data
int$fromthe time to check updates from
array$filterif we need to check only specific updates
Return values
stdClassan object with the different type of areas indicating if they were updated or not
Since
Moodle 3.2

◆ forum_cm_info_view()

forum_cm_info_view ( cm_info  $cm)

Adds information about unread messages, that is only required for the course view page (and similar), to the course-module object.

Parameters
cm_info$cmCourse-module object

◆ forum_convert_to_roles()

forum_convert_to_roles ( )
Deprecated:
since Moodle 2.0 MDL-23479 - please do not use this function any more.

◆ forum_count_discussion_replies()

forum_count_discussion_replies (   $forumid,
  $forumsort = "",
  $limit = -1,
  $page = -1,
  $perpage = 0,
  $canseeprivatereplies = false 
)

Returns an array of counts of replies to each discussion.

Parameters
int$forumid
string$forumsort
int$limit
int$page
int$perpage
boolean$canseeprivaterepliesWhether the current user can see private replies.
Return values
array

◆ forum_count_discussions()

object forum_count_discussions (   $forum,
  $cm,
  $course 
)

@global object @global object @staticvar array $cache

Parameters
object$forum
object$cm
object$course
Return values
mixed

◆ forum_count_replies()

forum_count_replies (   $post,
  $children = true 
)

Count the number of replies to the specified post.

Parameters
object$post
bool$children
Return values
int
Deprecated:
since Moodle 3.7
Todo:
MDL-65252 This will be removed in Moodle 4.1

◆ forum_count_unrated_posts()

forum_count_unrated_posts ( )
Deprecated:
since Moodle 1.1 - please do not use this function any more.

◆ forum_count_user_posts()

object forum_count_user_posts (   $forumid,
  $userid 
)

Get all the posts for a user in a forum suitable for forum_print_post.

@global object

Parameters
int$forumid
int$userid
Return values
arrayof counts or false

◆ forum_cron()

forum_cron ( )

Function to be run periodically according to the scheduled task.

Finds all posts that have yet to be mailed out, and mails them out to all subscribers as well as other maintance tasks.

Deprecated:
since Moodle 3.7

◆ forum_cron_minimise_user_record()

forum_cron_minimise_user_record ( stdClass  $user)

Removes properties from user record that are not necessary for sending post notifications.

Parameters
stdClass$user
Return values
void,$userparameter is modified
Deprecated:
since Moodle 3.7

◆ forum_delete_discussion()

object forum_delete_discussion (   $discussion,
  $fulldelete,
  $course,
  $cm,
  $forum 
)

Deletes a discussion and handles all associated cleanup.

Parameters
object$discussionDiscussion to delete
bool$fulldeleteTrue when deleting entire forum
object$courseCourse
object$cmCourse-module
object$forumForum
Return values
bool

◆ forum_delete_instance()

object forum_delete_instance (   $id)

Given an ID of an instance of this module, this function will permanently delete the instance and any data that depends on it.

Parameters
int$idforum instance id
Return values
boolsuccess

◆ forum_delete_post()

object forum_delete_post (   $post,
  $children,
  $course,
  $cm,
  $forum,
  $skipcompletion = false 
)

Deletes a single forum post.

Parameters
object$postForum post object
mixed$childrenWhether to delete children. If false, returns false if there are any children (without deleting the post). If true, recursively deletes all children. If set to special value 'ignore', deletes post regardless of children (this is for use only when deleting all posts in a disussion).
object$courseCourse
object$cmCourse-module
object$forumForum
bool$skipcompletionTrue to skip updating completion state if it would otherwise be updated, i.e. when deleting entire forum anyway.
Return values
bool

◆ forum_discussion_is_locked()

forum_discussion_is_locked (   $forum,
  $discussion 
)

Determine whether the specified discussion is time-locked.

Parameters
stdClass$forumThe forum that the discussion belongs to
stdClass$discussionThe discussion to test
Return values
bool

◆ forum_discussion_pin()

forum_discussion_pin (   $modcontext,
  $forum,
  $discussion 
)

Set the discussion to pinned and trigger the discussion pinned event.

Parameters
stdClass$modcontextmodule context object
stdClass$forumforum object
stdClass$discussiondiscussion object
Since
Moodle 3.1

◆ forum_discussion_unpin()

forum_discussion_unpin (   $modcontext,
  $forum,
  $discussion 
)

Set discussion to unpinned and trigger the discussion unpin event.

Parameters
stdClass$modcontextmodule context object
stdClass$forumforum object
stdClass$discussiondiscussion object
Since
Moodle 3.1

◆ forum_discussion_update_last_post()

object forum_discussion_update_last_post (   $discussionid)

Sets the last post for a given discussion.

@global object

Parameters
into$discussionid
Return values
bool|int

◆ forum_discussion_view()

forum_discussion_view (   $modcontext,
  $forum,
  $discussion 
)

Trigger the discussion viewed event.

Parameters
stdClass$modcontextmodule context object
stdClass$forumforum object
stdClass$discussiondiscussion object
Since
Moodle 2.9

◆ forum_discussions_user_has_posted_in()

object forum_discussions_user_has_posted_in (   $forumid,
  $userid 
)

@global object

Parameters
int$forumid
int$userid
Return values
array

◆ forum_extend_settings_navigation()

forum_extend_settings_navigation ( settings_navigation  $settingsnav,
navigation_node  $forumnode 
)

Adds module specific settings to the settings block.

Parameters
settings_navigation$settingsThe settings navigation object
navigation_node$forumnodeThe node to add module settings to

◆ forum_filter_user_groups_discussions()

forum_filter_user_groups_discussions ( )
Deprecated:
since Moodle 3.3, when the block_course_overview block was removed.

◆ forum_forcesubscribe()

forum_forcesubscribe (   $forumid,
  $value = 1 
)
Deprecated:
since Moodle 2.8 use mod_forum\subscriptions::set_subscription_mode() instead

◆ forum_get_all_discussion_posts()

forum_get_all_discussion_posts (   $discussionid,
  $sort,
  $tracking = false 
)

Gets all posts in discussion including top parent.

Parameters
int$discussionidThe Discussion to fetch.
string$sortThe sorting to apply.
bool$trackingWhether the user tracks this forum.
Return values
arrayThe posts in the discussion.

◆ forum_get_child_posts()

forum_get_child_posts ( )
Deprecated:
since Moodle 1.9 MDL-13303 - please do not use this function any more.

◆ forum_get_completion_state()

object forum_get_completion_state (   $course,
  $cm,
  $userid,
  $type 
)

Obtains the automatic completion state for this forum based on any conditions in forum settings.

@global object

Parameters
object$courseCourse
object$cmCourse-module
int$useridUser ID
bool$typeType of comparison (or/and; can be used as return value if no conditions)
Return values
boolTrue if completed, false if not. (If no conditions, then return value depends on comparison type)

◆ forum_get_context()

forum_get_context (   $forumid,
  $context = null 
)

Determine the current context if one was not already specified.

If a context of type context_module is specified, it is immediately returned and not checked.

Parameters
int$forumidThe ID of the forum
context_module$contextThe current context.
Return values
context_moduleThe context determined

◆ forum_get_course_forum()

object forum_get_course_forum (   $courseid,
  $type 
)

@global object

Parameters
int$courseid
string$type

◆ forum_get_coursemodule_info()

forum_get_coursemodule_info (   $coursemodule)

Add a get_coursemodule_info function in case any forum type wants to add 'extra' information for the course (see resource).

Given a course_module object, this function returns any "extra" information that may be needed when printing this activity in a course listing. See get_array_of_activities() in course/lib.php.

Parameters
stdClass$coursemoduleThe coursemodule object (record).
Return values
cached_cm_infoAn object on information that the courses will know about (most noticeably, an icon).

◆ forum_get_courses_user_posted_in()

moodle_database forum_get_courses_user_posted_in (   $user,
  $discussionsonly = false,
  $includecontexts = true,
  $limitfrom = null,
  $limitnum = null 
)

Gets all of the courses where the provided user has posted in a forum.

$DB The database connection

Parameters
stdClass$userThe user who's posts we are looking for
bool$discussionsonlyIf true only look for discussions started by the user
bool$includecontextsIf set to trye contexts for the courses will be preloaded
int$limitfromThe offset of records to return
int$limitnumThe number of records to return
Return values
arrayAn array of courses

◆ forum_get_default_sort_order()

forum_get_default_sort_order (   $desc = true,
  $compare = 'd.timemodified',
  $prefix = 'd',
  $pinned = true 
)

Get the sql to use in the ORDER BY clause for forum discussions.

This has the ordering take timed discussion windows into account.

Parameters
bool$descTrue for DESC, False for ASC.
string$compareThe field in the SQL to compare to normally sort by.
string$prefixThe prefix being used for the discussion table.
bool$pinnedsort pinned posts to the top
Return values
string

◆ forum_get_discussion_neighbours()

forum_get_discussion_neighbours (   $cm,
  $discussion,
  $forum 
)

Gets the neighbours (previous and next) of a discussion.

The calculation is based on the timemodified when time modified or time created is identical It will revert to using the ID to sort consistently. This is better tha skipping a discussion.

For blog-style forums, the calculation is based on the original creation time of the blog post.

Please note that this does not check whether or not the discussion passed is accessible by the user, it simply uses it as a reference to find the neighbours. On the other hand, the returned neighbours are checked and are accessible to the current user.

Parameters
object$cmThe CM record.
object$discussionThe discussion record.
object$forumThe forum instance record.
Return values
arrayThat always contains the keys 'prev' and 'next'. When there is a result they contain the record with minimal information such as 'id' and 'name'. When the neighbour is not found the value is false.

◆ forum_get_discussion_posts()

forum_get_discussion_posts ( )
Deprecated:
since Moodle 1.9 MDL-13303 - please do not use this function any more.

◆ forum_get_discussion_subscription_icon()

forum_get_discussion_subscription_icon (   $forum,
  $discussionid,
  $returnurl = null,
  $includetext = false 
)

Return the markup for the discussion subscription toggling icon.

Parameters
stdClass$forumThe forum object.
int$discussionidThe discussion to create an icon for.
Return values
stringThe generated markup.

◆ forum_get_discussion_subscription_icon_preloaders()

forum_get_discussion_subscription_icon_preloaders ( )

Return a pair of spans containing classes to allow the subscribe and unsubscribe icons to be pre-loaded by a browser.

Return values
stringThe generated markup

◆ forum_get_discussions()

object forum_get_discussions (   $cm,
  $forumsort = "",
  $fullpost = true,
  $unused = -1,
  $limit = -1,
  $userlastmodified = false,
  $page = -1,
  $perpage = 0,
  $groupid = -1,
  $updatedsince = 0 
)

Get all discussions in a forum.

@global object @global object @uses CONTEXT_MODULE @uses VISIBLEGROUPS

Parameters
object$cm
string$forumsort
bool$fullpost
int$unused
int$limit
bool$userlastmodified
int$page
int$perpage
int$groupidif groups enabled, get discussions for this group overriding the current group. Use FORUM_POSTS_ALL_USER_GROUPS for all the user groups
int$updatedsinceretrieve only discussions updated since the given time
Return values
array

◆ forum_get_discussions_count()

object forum_get_discussions_count (   $cm)

@global object @global object @uses CONEXT_MODULE @uses VISIBLEGROUPS

Parameters
object$cm
Return values
array

◆ forum_get_discussions_unread()

object forum_get_discussions_unread (   $cm)

@global object @global object @uses CONTEXT_MODULE @uses VISIBLEGROUPS

Parameters
object$cm
Return values
array

◆ forum_get_email_message_id()

forum_get_email_message_id (   $postid,
  $usertoid 
)

Create a message-id string to use in the custom headers of forum notification emails.

message-id is used by email clients to identify emails and to nest conversations

Parameters
int$postidThe ID of the forum post we are notifying the user about
int$usertoidThe ID of the user being notified
Return values
stringA unique message-id

◆ forum_get_extra_capabilities()

forum_get_extra_capabilities ( )

Returns all other caps used in module.

Return values
array

◆ forum_get_firstpost_from_discussion()

object forum_get_firstpost_from_discussion (   $discussionid)

Given a discussion id, return the first post from the discussion.

@global object

Parameters
int$dicsussionid
Return values
array

◆ forum_get_forcesubscribed()

forum_get_forcesubscribed (   $forum)
Deprecated:
since Moodle 2.8 use mod_forum\subscriptions::get_subscription_mode() instead

◆ forum_get_forum_types()

forum_get_forum_types ( )

Returns array of forum types chooseable on the forum editing form.

Return values
array

◆ forum_get_forum_types_all()

forum_get_forum_types_all ( )

Returns array of all forum layout modes.

Return values
array

◆ forum_get_forums_user_posted_in()

moodle_database forum_get_forums_user_posted_in (   $user,
array  $courseids = null,
  $discussionsonly = false,
  $limitfrom = null,
  $limitnum = null 
)

Gets all of the forums a user has posted in for one or more courses.

$DB

Parameters
stdClass$user
array$courseidsAn array of courseids to search or if not provided all courses the user has posted within
bool$discussionsonlyIf true then only forums where the user has started a discussion will be returned.
int$limitfromThe offset of records to return
int$limitnumThe number of records to return
Return values
arrayAn array of forums the user has posted within in the provided courses

◆ forum_get_layout_modes()

forum_get_layout_modes ( bool  $useexperimentalui = false)

Returns array of forum layout modes.

Parameters
bool$useexperimentaluiuse experimental layout modes or not
Return values
array

◆ forum_get_open_modes()

forum_get_open_modes ( )
Deprecated:
since Moodle 1.7 - please do not use this function any more.

◆ forum_get_optional_subscribed_forums()

forum_get_optional_subscribed_forums ( )
Deprecated:
since Moodle 2.8 use mod_forum\subscriptions::get_unsubscribable_forums() instead

◆ forum_get_post_actions()

forum_get_post_actions ( )

List the actions that correspond to a post of this module.

This is used by the participation report.

Note: This is not used by new logging system. Event with crud = ('c' || 'u' || 'd') and edulevel = LEVEL_PARTICIPATING will be considered as post action.

Return values
array

◆ forum_get_post_from_log()

object forum_get_post_from_log (   $log)

Given a log entry, return the forum post details for it.

@global object

Parameters
object$log
Return values
array|null

◆ forum_get_post_full()

object forum_get_post_full (   $postid)

Gets a post with all info ready for forum_print_post Most of these joins are just to get the forum id.

@global object

Parameters
int$postid
Return values
mixedarray of posts or false

◆ forum_get_posts_by_user()

moodle_database forum_get_posts_by_user (   $user,
array  $courses,
  $musthaveaccess = false,
  $discussionsonly = false,
  $limitfrom = 0,
  $limitnum = 50 
)

Returns posts made by the selected user in the requested courses.

This method can be used to return all of the posts made by the requested user within the given courses. For each course the access of the current user and requested user is checked and then for each post access to the post and forum is checked as well.

This function is safe to use with usercapabilities.

$DB

Parameters
stdClass$userThe user whose posts we want to get
array$coursesThe courses to search
bool$musthaveaccessIf set to true errors will be thrown if the user cannot access one or more of the courses to search
bool$discussionsonlyIf set to true only discussion starting posts will be returned.
int$limitfromThe offset of records to return
int$limitnumThe number of records to return
Return values
stdClassAn object the following properties ->totalcount: the total number of posts made by the requested user that the current user can see. ->courses: An array of courses the current user can see that the requested user has posted in. ->forums: An array of forums relating to the posts returned in the property below. ->posts: An array containing the posts to show for this request.

◆ forum_get_potential_subscribers()

forum_get_potential_subscribers ( )
Deprecated:
since Moodle 2.8 use mod_forum\subscriptions::get_potential_subscribers() instead

◆ forum_get_ratings()

forum_get_ratings ( )
Deprecated:
since Moodle 2.0 MDL-21657 - please do not use this function any more.

◆ forum_get_readable_forums()

object forum_get_readable_forums (   $userid,
  $courseid = 0 
)

An array of forum objects that the user is allowed to read/search through.

@global object @global object

Parameters
int$userid
int$courseidif 0, we look for forums throughout the whole site.
Return values
arrayof forum objects, or false if no matches Forum objects have the following attributes: id, type, course, cmid, cmvisible, cmgroupmode, accessallgroups, viewhiddentimedposts

◆ forum_get_recent_mod_activity()

object forum_get_recent_mod_activity ( $activities,
$index,
  $timestart,
  $courseid,
  $cmid,
  $userid = 0,
  $groupid = 0 
)

Returns all forum posts since a given time in specified forum.

Todo:
Document this functions args

@global object @global object @global object

◆ forum_get_subscribe_link()

forum_get_subscribe_link (   $forum,
  $context,
  $messages = array(),
  $cantaccessagroup = false,
  $unused1 = true,
  $backtoindex = false,
  $unused2 = null 
)

Generate and return the subscribe or unsubscribe link for a forum.

Parameters
object$forumthe forum. Fields used are $forum->id and $forum->forcesubscribe.
object$contextthe context object for this forum.
array$messagestext used for the link in its various states (subscribed, unsubscribed, forcesubscribed or cantsubscribe). Any strings not passed in are taken from the $defaultmessages array at the top of the function.
bool$cantaccessagroup
bool$unused1
bool$backtoindex
array$unused2
Return values
string

◆ forum_get_subscribed_forums()

forum_get_subscribed_forums ( )
Deprecated:
since Moodle 2.8 use mod_forum\subscriptions::is_subscribed in combination wtih mod_forum\subscriptions::fill_subscription_cache_for_course instead.

◆ forum_get_subscriptionmode_options()

forum_get_subscriptionmode_options ( )

List the options for forum subscription modes.

This is used by the settings page and by the mod_form page.

Return values
array

◆ forum_get_tracking_link()

forum_get_tracking_link ( )
Deprecated:
since Moodle 2.0 MDL-14632 - please do not use this function any more.

◆ forum_get_user_digest_options()

forum_get_user_digest_options (   $user = null)

Retrieve the list of available user digest options.

Parameters
stdClass$userThe user object. This defaults to the global $USER object.
Return values
arrayThe mapping of values to digest options.

◆ forum_get_user_discussions()

forum_get_user_discussions ( )
Deprecated:
since Moodle 1.5 - please do not use this function any more.

◆ forum_get_user_grades()

forum_get_user_grades (   $forum,
  $userid = 0 
)

Return grade for given user or all users.

Deprecated:
since Moodle 3.8
Parameters
object$forum
int$useridoptional user id, 0 means all users
Return values
arrayarray of grades, false if none

◆ forum_get_user_involved_discussions()

object forum_get_user_involved_discussions (   $forumid,
  $userid 
)

Get all the discussions user participated in.

@global object @uses CONTEXT_MODULE

Parameters
int$forumid
int$userid
Return values
arrayArray or false

◆ forum_get_user_maildigest_bulk()

forum_get_user_maildigest_bulk (   $digests,
  $user,
  $forumid 
)

Determine the maildigest setting for the specified user against the specified forum.

Parameters
Array$digestsAn array of forums and user digest settings.
stdClass$userThe user object containing the id and maildigest default.
int$forumidThe ID of the forum to check.
Return values
intThe calculated maildigest setting for this user and forum.

◆ forum_get_user_posted_time()

object forum_get_user_posted_time (   $did,
  $userid 
)

Returns creation time of the first user's post in given discussion $DB.

Parameters
int$didDiscussion id
int$useridUser id
Return values
int|boolpost creation time stamp or return false

◆ forum_get_user_posts()

object forum_get_user_posts (   $forumid,
  $userid 
)

Get all the posts for a user in a forum suitable for forum_print_post.

@global object @uses CONTEXT_MODULE

Return values
array

◆ forum_get_view_actions()

forum_get_view_actions ( )

List the actions that correspond to a view of this module.

This is used by the participation report.

Note: This is not used by new logging system. Event with crud = 'r' and edulevel = LEVEL_PARTICIPATING will be considered as view action.

Return values
array

◆ forum_go_back_to()

object forum_go_back_to (   $default)
Parameters
string | moodle_url$default
Return values
string

◆ forum_grade_item_delete()

forum_grade_item_delete (   $forum)

Delete grade item for given forum.

Parameters
stdClass$forumForum object

◆ forum_grade_item_update()

forum_grade_item_update (   $forum,
  $ratings = null,
  $forumgrades = null 
)

Create/update grade items for given forum.

Parameters
stdClass$forumForum object with extra cmidnumber
mixed$gradesOptional array/object of grade(s); 'reset' means reset grades in gradebook

◆ forum_grading_areas_list()

forum_grading_areas_list ( )

Lists all gradable areas for the advanced grading methods gramework.

Return values
array('string'=>'string')An array with area names as keys and descriptions as values

◆ forum_instance_created()

forum_instance_created (   $context,
  $forum 
)

Handle changes following the creation of a forum instance.

This function is typically called by the course_module_created observer.

Parameters
object$contextthe forum context
stdClass$forumThe forum object
Return values
void

◆ forum_is_author_hidden()

forum_is_author_hidden (   $post,
  $forum 
)

Checks whether the author's name and picture for a given post should be hidden or not.

Parameters
object$postThe forum post.
object$forumThe forum object.
Return values
bool
Exceptions
coding_exception

◆ forum_is_cutoff_date_reached()

forum_is_cutoff_date_reached (   $forum)

Determine whether the specified forum's cutoff date is reached.

Parameters
stdClass$forumThe forum
Return values
bool

◆ forum_is_due_date_reached()

forum_is_due_date_reached (   $forum)

Determine whether the specified forum's due date is reached.

Parameters
stdClass$forumThe forum
Return values
bool

◆ forum_is_forcesubscribed()

forum_is_forcesubscribed (   $forum)

Determine whether the forum is force subscribed.

Deprecated:
since Moodle 2.8 use mod_forum\subscriptions::is_forcesubscribed() instead

◆ forum_is_subscribed()

forum_is_subscribed ( )
Deprecated:
since Moodle 2.8 use mod_forum\subscriptions::is_subscribed() instead

◆ forum_is_user_group_discussion()

forum_is_user_group_discussion ( cm_info  $cm,
  $discussiongroupid 
)

Returns whether the discussion group is visible by the current user or not.

Since
Moodle 2.8, 2.7.1, 2.6.4
Parameters
cm_info$cmThe discussion course module
int$discussiongroupidThe discussion groupid
Return values
bool

◆ forum_make_mail_html()

forum_make_mail_html (   $course,
  $cm,
  $forum,
  $discussion,
  $post,
  $userfrom,
  $userto,
  $replyaddress = null 
)

Builds and returns the body of the email notification in html format.

Parameters
object$course
object$cm
object$forum
object$discussion
object$post
object$userfrom
object$userto
string$replyaddressThe inbound address that a user can reply to the generated e-mail with. [Since 2.8].
Return values
stringThe email text in HTML format
Deprecated:
since Moodle 3.0 use mod_forum\output\forum_post_email instead

◆ forum_make_mail_post()

forum_make_mail_post (   $course,
  $cm,
  $forum,
  $discussion,
  $post,
  $userfrom,
  $userto,
  $ownpost = false,
  $reply = false,
  $link = false,
  $rate = false,
  $footer = "" 
)

Given the data about a posting, builds up the HTML to display it and returns the HTML in a string.

This is designed for sending via HTML email.

Parameters
object$course
object$cm
object$forum
object$discussion
object$post
object$userfrom
object$userto
bool$ownpost
bool$reply
bool$link
bool$rate
string$footer
Return values
string
Deprecated:
since Moodle 3.0 use mod_forum\output\forum_post_email instead

◆ forum_make_mail_text()

forum_make_mail_text (   $course,
  $cm,
  $forum,
  $discussion,
  $post,
  $userfrom,
  $userto,
  $bare = false,
  $replyaddress = null 
)

Builds and returns the body of the email notification in plain text.

@uses CONTEXT_MODULE

Parameters
object$course
object$cm
object$forum
object$discussion
object$post
object$userfrom
object$userto
boolean$bare
string$replyaddressThe inbound address that a user can reply to the generated e-mail with. [Since 2.8].
Return values
stringThe email body in plain text format.
Deprecated:
since Moodle 3.0 use mod_forum\output\forum_post_email instead

◆ forum_move_attachments()

object forum_move_attachments (   $discussion,
  $forumfrom,
  $forumto 
)

Given a discussion object that is being moved to $forumto, this function checks all posts in that discussion for attachments, and if any are found, these are moved to the new forum directory.

Parameters
object$discussion
int$forumfromsource forum id
int$forumtotarget forum id
Return values
boolsuccess

◆ forum_page_type_list()

forum_page_type_list (   $pagetype,
  $parentcontext,
  $currentcontext 
)

Return a list of page types.

Parameters
string$pagetypecurrent page type
stdClass$parentcontextBlock's parent context
stdClass$currentcontextCurrent context of block

◆ forum_post_is_visible_privately()

forum_post_is_visible_privately (   $post,
  $cm 
)

Check whether the forum post is a private reply visible to this user.

Parameters
stdClass$postThe post to check.
cm_info$cmThe context module instance.
Return values
boolWhether the post is visible in terms of private reply configuration.

◆ forum_post_nesting_cache()

forum_post_nesting_cache ( )

Return a static array of posts that are open.

Return values
array
Deprecated:
since Moodle 3.7

◆ forum_post_subscription()

forum_post_subscription (   $fromform,
  $forum,
  $discussion 
)

Given a new post, subscribes or unsubscribes as appropriate.

Returns some text which describes what happened.

Parameters
object$fromformThe submitted form
stdClass$forumThe forum record
stdClass$discussionThe forum discussion record
Return values
string

◆ forum_print_attachments()

object forum_print_attachments (   $post,
  $cm,
  $type 
)

Returns attachments as formated text/html optionally with separate images.

@global object @global object

Parameters
object$post
object$cm
string$typehtml/text/separateimages
Return values
mixedstring or array of (html text withouth images and image HTML)

◆ forum_print_discussion()

forum_print_discussion (   $course,
  $cm,
  $forum,
  $discussion,
  $post,
  $mode,
  $canreply = NULL,
  $canrate = false 
)

Prints a forum discussion.

@uses CONTEXT_MODULE @uses FORUM_MODE_FLATNEWEST @uses FORUM_MODE_FLATOLDEST @uses FORUM_MODE_THREADED @uses FORUM_MODE_NESTED

Parameters
stdClass$course
stdClass$cm
stdClass$forum
stdClass$discussion
stdClass$post
int$mode
mixed$canreply
bool$canrate
Deprecated:
since Moodle 3.7

◆ forum_print_discussion_header()

object forum_print_discussion_header ( $post,
  $forum,
  $group = -1,
  $datestring = "",
  $cantrack = true,
  $forumtracked = true,
  $canviewparticipants = true,
  $modcontext = null,
  $canviewhiddentimedposts = false 
)

This function prints the overview of a discussion in the forum listing.

It needs some discussion information and some post information, these happen to be combined for efficiency in the $post parameter by the function that calls this one: forum_print_latest_discussions()

@global object

Parameters
object$postThe post object (passed by reference for speed).
object$forumThe forum object.
int$groupCurrent group.
string$datestringFormat to use for the dates.
boolean$cantrackIs tracking enabled for this forum.
boolean$forumtrackedIs the user tracking this forum.
boolean$canviewparticipantsTrue if user has the viewparticipants permission for this course
boolean$canviewhiddentimedpostsTrue if user has the viewhiddentimedposts permission for this forum

◆ forum_print_latest_discussions()

forum_print_latest_discussions (   $course,
  $forum,
  $maxdiscussions = -1,
  $displayformat = 'plain',
  $sort = '',
  $currentgroup = -1,
  $groupmode = -1,
  $page = -1,
  $perpage = 100,
  $cm = null 
)

Prints the discussion view screen for a forum.

Parameters
object$courseThe current course object.
object$forumForum to be printed.
int$maxdiscussions
string$displayformatThe display format to use (optional).
string$sortSort arguments for database query (optional).
int$currentgroup
int$groupmodeGroup mode of the forum (optional).
int$pagePage mode, page to display (optional).
int$perpageThe maximum number of discussions per page(optional)
stdClass$cm
Deprecated:
since Moodle 3.7

◆ forum_print_mode_form()

forum_print_mode_form (   $id,
  $mode,
  $forumtype = '' 
)

Print the drop down that allows the user to select how they want to have the discussion displayed.

Parameters
int$idforum id if $forumtype is 'single', discussion id for any other forum type
mixed$modeforum layout mode
string$forumtypeoptional

◆ forum_print_overview()

forum_print_overview ( )
Deprecated:
since Moodle 3.3, when the block_course_overview block was removed.

◆ forum_print_post()

object forum_print_post (   $post,
  $discussion,
  $forum,
$cm,
  $course,
  $ownpost = false,
  $reply = false,
  $link = false,
  $footer = "",
  $highlight = "",
  $postisread = null,
  $dummyifcantsee = true,
  $istracked = null,
  $return = false 
)

Print a forum post This function should always be surrounded with calls to forum_print_post_start and forum_print_post_end to create the surrounding container for the post.

Replies can be nested before forum_print_post_end and should reflect the structure of thread.

@global object @uses FORUM_MODE_THREADED @uses PORTFOLIO_FORMAT_PLAINHTML @uses PORTFOLIO_FORMAT_FILE @uses PORTFOLIO_FORMAT_RICHHTML @uses PORTFOLIO_ADD_TEXT_LINK @uses CONTEXT_MODULE

Parameters
object$postThe post to print.
object$discussion
object$forum
object$cm
object$course
boolean$ownpostWhether this post belongs to the current user.
boolean$replyWhether to print a 'reply' link at the bottom of the message.
boolean$linkJust print a shortened version of the post as a link to the full post.
string$footerExtra stuff to print after the message.
string$highlightSpace-separated list of terms to highlight.
int$post_readtrue, false or -99. If we already know whether this user has read this post, pass that in, otherwise, pass in -99, and this function will work it out.
boolean$dummyifcantseeWhen forum_user_can_see_post says that the current user can't see this post, if this argument is true (the default) then print a dummy 'you can't see this post' post. If false, don't output anything at all.
bool | null$istracked
Return values
void
Deprecated:
since Moodle 3.7

◆ forum_print_post_end()

forum_print_post_end (   $post,
  $return = false 
)

End a forum post container.

Parameters
object$postThe post to print.
bool$returnReturn the string or print it
Return values
string
Deprecated:
since Moodle 3.7

◆ forum_print_post_start()

forum_print_post_start (   $post,
  $return = false 
)

Start a forum post container.

Parameters
object$postThe post to print.
bool$returnReturn the string or print it
Return values
string
Deprecated:
since Moodle 3.7

◆ forum_print_posts_flat()

object forum_print_posts_flat (   $course,
$cm,
  $forum,
  $discussion,
  $post,
  $mode,
  $reply,
  $forumtracked,
  $posts 
)

@global object @uses FORUM_MODE_FLATNEWEST

Parameters
object$course
object$cm
object$forum
object$discussion
object$post
object$mode
bool$reply
bool$forumtracked
array$posts
Return values
void
Deprecated:
since Moodle 3.7

◆ forum_print_posts_nested()

object forum_print_posts_nested (   $course,
$cm,
  $forum,
  $discussion,
  $parent,
  $reply,
  $forumtracked,
  $posts 
)
Todo:
Document this function

@global object

Return values
void
Deprecated:
since Moodle 3.7

◆ forum_print_posts_threaded()

object forum_print_posts_threaded (   $course,
$cm,
  $forum,
  $discussion,
  $parent,
  $depth,
  $reply,
  $forumtracked,
  $posts 
)
Todo:
Document this function

@global object @uses CONTEXT_MODULE

Return values
void
Deprecated:
since Moodle 3.7

◆ forum_print_recent_activity()

object forum_print_recent_activity (   $course,
  $viewfullnames,
  $timestart 
)

Given a course and a date, prints a summary of all the new messages posted in the course since that date.

@global object @global object @uses CONTEXT_MODULE @uses VISIBLEGROUPS

Parameters
object$course
bool$viewfullnamescapability
int$timestart
Return values
boolsuccess

◆ forum_print_recent_mod_activity()

forum_print_recent_mod_activity (   $activity,
  $courseid,
  $detail,
  $modnames,
  $viewfullnames 
)

Outputs the forum post indicated by $activity.

Parameters
object$activitythe activity object the forum resides in
int$courseidthe id of the course the forum resides in
bool$detailnot used, but required for compatibilty with other modules
int$modnamesnot used, but required for compatibilty with other modules
bool$viewfullnamesnot used, but required for compatibilty with other modules

◆ forum_rating_permissions()

forum_rating_permissions (   $contextid,
  $component,
  $ratingarea 
)

Return rating related permissions.

Parameters
string$optionsthe context id
Return values
arrayan associative array of the user's rating permissions

◆ forum_rating_validate()

forum_rating_validate (   $params)

Validates a submitted rating.

Parameters
array$paramssubmitted data context => object the context in which the rated items exists [required] component => The component for this module - should always be mod_forum [required] ratingarea => object the context in which the rated items exists [required]

itemid => int the ID of the object being rated [required] scaleid => int the scale from which the user can select a rating. Used for bounds checking. [required] rating => int the submitted rating [required] rateduserid => int the id of the user whose items have been rated. NOT the user who submitted the ratings. 0 to update all. [required] aggregation => int the aggregation method to apply when calculating grades ie RATING_AGGREGATE_AVERAGE [required]

Return values
booleantrue if the rating is valid. Will throw rating_exception if not

◆ forum_reset_course_form_defaults()

forum_reset_course_form_defaults (   $course)

Course reset form defaults.

Return values
array

◆ forum_reset_course_form_definition()

forum_reset_course_form_definition ( $mform)

Called by course/reset.php.

Parameters
$mformform passed by reference

◆ forum_reset_gradebook()

object forum_reset_gradebook (   $courseid,
  $type = '' 
)

Removes all grades from gradebook.

@global object

Parameters
int$courseid
string$typeoptional

◆ forum_reset_userdata()

object forum_reset_userdata (   $data)

This function is used by the reset_course_userdata function in moodlelib.

This function will remove all posts from the specified forum and clean up any related data.

@global object

Parameters
$datathe data submitted from the reset course.
Return values
arraystatus array

◆ forum_rss_delete_file()

forum_rss_delete_file (   $forum)

Given a forum object, deletes all cached RSS files associated with it.

Parameters
stdClass$forum

◆ forum_rss_feed_contents()

forum_rss_feed_contents (   $forum,
  $sql,
  $params,
  $context 
)

This function return the XML rss contents about the forum It returns false if something is wrong.

Parameters
stdClass$forumthe forum object
string$sqlthe SQL used to retrieve the contents from the database
array$paramsthe SQL parameters used
object$contextthe context this forum relates to
Return values
bool|stringfalse if the contents is empty, otherwise the contents of the feed is returned

@Todo MDL-31129 implement post attachment handling

◆ forum_rss_feed_discussions_sql()

forum_rss_feed_discussions_sql (   $forum,
  $cm,
  $newsince = 0 
)

Generates the SQL query used to get the Discussion details from the forum table of the database.

Parameters
stdClass$forumthe forum object
stdClass$cmCourse Module object
int$newsincecheck for items since this epoch timestamp
Return values
stringthe SQL query to be used to get the Discussion details from the forum table of the database

◆ forum_rss_feed_posts_sql()

forum_rss_feed_posts_sql (   $forum,
  $cm,
  $newsince = 0 
)

Generates the SQL query used to get the Post details from the forum table of the database.

Parameters
stdClass$forumthe forum object
stdClass$cmCourse Module object
int$newsincecheck for items since this epoch timestamp
Return values
stringthe SQL query to be used to get the Post details from the forum table of the database

◆ forum_rss_get_feed()

forum_rss_get_feed (   $context,
  $args 
)

Returns the path to the cached rss feed contents.

Creates/updates the cache if necessary.

Parameters
stdClass$contextthe context
array$argsthe arguments received in the url
Return values
stringthe full path to the cached RSS feed directory. Null if there is a problem.

◆ forum_rss_get_group_sql()

forum_rss_get_group_sql (   $cm,
  $groupmode,
  $currentgroup,
  $modcontext = null 
)

Retrieve the correct SQL snippet for group-only forums.

Parameters
stdClass$cmCourse Module object
int$groupmodethe mode in which the forum's groups are operating
bool$currentgrouptrue if the user is from the a group enabled on the forum
stdClass$modcontextThe context instance of the forum module
Return values
stringSQL Query for group details of the forum

◆ forum_rss_get_sql()

forum_rss_get_sql (   $forum,
  $cm,
  $time = 0 
)

Determines which type of SQL query is required, one for posts or one for discussions, and returns the appropriate query.

Parameters
stdClass$forumthe forum object
stdClass$cmCourse Module object
int$timecheck for items since this epoch timestamp
Return values
stringthe SQL query to be used to get the Discussion/Post details from the forum table of the database

◆ forum_rss_newstuff()

forum_rss_newstuff (   $forum,
  $cm,
  $time 
)

If there is new stuff in the forum since $time this returns true Otherwise it returns false.

Parameters
stdClass$forumthe forum object
stdClass$cmCourse Module object
int$timecheck for items since this epoch timestamp
Return values
boolTrue for new items

◆ forum_scale_used()

forum_scale_used ( )
Deprecated:
since Moodle 3.8

◆ forum_scale_used_anywhere()

forum_scale_used_anywhere ( int  $scaleid)

Checks if scale is being used by any instance of forum.

This is used to find out if scale used anywhere.

Parameters
$scaleidint
Return values
booleanTrue if the scale is used by any forum

◆ forum_search_form()

object forum_search_form (   $course,
  $search = '' 
)
Parameters
object$course
string$search
Return values
string

◆ forum_search_posts()

object forum_search_posts (   $searchterms,
  $courseid = 0,
  $limitfrom = 0,
  $limitnum = 50,
$totalcount,
  $extrasql = '' 
)

Returns a list of posts found using an array of search terms.

@global object @global object

Parameters
array$searchtermsarray of search terms, e.g. word +word -word
int$courseidif 0, we search through the whole site
int$limitfrom
int$limitnum
int&$totalcount
string$extrasql
Return values
array|boolArray of posts found or false

◆ forum_set_user_maildigest()

forum_set_user_maildigest (   $forum,
  $maildigest,
  $user = null 
)

Set the per-forum maildigest option for the specified user.

Parameters
stdClass$forumThe forum to set the option for.
int$maildigestThe maildigest option.
stdClass$userThe user object. This defaults to the global $USER object.
Exceptions
invalid_digest_settingthrown if an invalid maildigest option is provided.

◆ forum_shorten_post()

forum_shorten_post (   $message)
Deprecated:
since Moodle 2.6
See also
shorten_text()

◆ forum_should_end_post_nesting()

forum_should_end_post_nesting (   $id)

Return true when all the opens are nested with a close.

Parameters
int$idThe id of the post to end
Return values
bool
Deprecated:
since Moodle 3.7

◆ forum_should_start_post_nesting()

forum_should_start_post_nesting (   $id)

Return true for the first time this post was started.

Parameters
int$idThe id of the post to start
Return values
bool
Deprecated:
since Moodle 3.7

◆ forum_subscribe()

forum_subscribe ( )
Deprecated:
since Moodle 2.8 use mod_forum\subscriptions::subscribe_user() instead

◆ forum_subscribed_users()

forum_subscribed_users ( )
Deprecated:
since Moodle 2.8 use mod_forum\subscriptions::fetch_subscribed_users() instead

◆ forum_supports()

forum_supports (   $feature)

Indicates API features that the forum supports.

@uses FEATURE_GROUPS @uses FEATURE_GROUPINGS @uses FEATURE_MOD_INTRO @uses FEATURE_COMPLETION_TRACKS_VIEWS @uses FEATURE_COMPLETION_HAS_RULES @uses FEATURE_GRADE_HAS_GRADE @uses FEATURE_GRADE_OUTCOMES

Parameters
string$feature
Return values
mixedTrue if yes (some features may use other values)

◆ forum_tp_add_read_record()

object forum_tp_add_read_record (   $userid,
  $postid 
)

Mark post as read.

@global object

Parameters
int$userid
int$postid

◆ forum_tp_can_track_forums()

object forum_tp_can_track_forums (   $forum = false,
  $user = false 
)

Determine if a user can track forums and optionally a particular forum.

Checks the site settings, the user settings and the forum settings (if requested).

@global object @global object

Parameters
mixed$forumThe forum object to test, or the int id (optional).
mixed$useridThe user object to check for (optional).
Return values
boolean

◆ forum_tp_clean_read_records()

object forum_tp_clean_read_records ( )

Clean old records from the forum_read table.

@global object

Return values
void

◆ forum_tp_count_discussion_read_records()

forum_tp_count_discussion_read_records ( )
Deprecated:
since Moodle 1.5 - please do not use this function any more.

◆ forum_tp_count_discussion_unread_posts()

forum_tp_count_discussion_unread_posts ( )
Deprecated:
since Moodle 2.0 MDL-14113 - please do not use this function any more.

◆ forum_tp_count_forum_posts()

forum_tp_count_forum_posts ( )
Deprecated:
since Moodle 1.6 - please do not use this function any more.

◆ forum_tp_count_forum_read_records()

forum_tp_count_forum_read_records ( )
Deprecated:
since Moodle 1.6 - please do not use this function any more.

◆ forum_tp_count_forum_unread_posts()

object forum_tp_count_forum_unread_posts (   $cm,
  $course,
  $resetreadcache = false 
)

Returns the count of records for the provided user and forum and [optionally] group.

@global object @global object

Parameters
object$cm
object$course
bool$resetreadcacheoptional, true to reset the function static $readcache var
Return values
int

◆ forum_tp_delete_read_records()

object forum_tp_delete_read_records (   $userid = -1,
  $postid = -1,
  $discussionid = -1,
  $forumid = -1 
)

Deletes read records for the specified index.

At least one parameter must be specified.

Parameters
int$userid
int$postid
int$discussionid
int$forumid
Return values
bool

◆ forum_tp_get_course_unread_posts()

object forum_tp_get_course_unread_posts (   $userid,
  $courseid 
)

Returns the count of records for the provided user and course.

Please note that group access is ignored!

@global object

Parameters
int$userid
int$courseid
Return values
array

◆ forum_tp_get_discussion_read_records()

forum_tp_get_discussion_read_records ( )
Deprecated:
since Moodle 2.0 MDL-14113 - please do not use this function any more.

◆ forum_tp_get_read_records()

forum_tp_get_read_records ( )
Deprecated:
since Moodle 2.0 MDL-14113 - please do not use this function any more.

◆ forum_tp_get_untracked_forums()

object forum_tp_get_untracked_forums (   $userid,
  $courseid 
)

Get a list of forums not tracked by the user.

@global object

Parameters
int$useridThe id of the user to use.
int$courseidThe id of the course being checked.
Return values
mixedAn array indexed by forum id, or false.

◆ forum_tp_is_post_old()

object forum_tp_is_post_old (   $post,
  $time = null 
)
Parameters
object$post
int$timeDefautls to time()

◆ forum_tp_is_post_read()

object forum_tp_is_post_read (   $userid,
  $post 
)
Parameters
int$userid
object$post

◆ forum_tp_is_tracked()

object forum_tp_is_tracked (   $forum,
  $user = false 
)

Tells whether a specific forum is tracked by the user.

A user can optionally be specified. If not specified, the current user is assumed.

@global object @global object

Parameters
mixed$forumIf int, the id of the forum being checked; if object, the forum object
int$useridThe id of the user being checked (optional).
Return values
boolean

◆ forum_tp_mark_discussion_read()

object forum_tp_mark_discussion_read (   $user,
  $discussionid 
)

Marks a whole discussion as read, for a given user.

@global object

Parameters
object$user
int$discussionid
Return values
bool

◆ forum_tp_mark_forum_read()

object forum_tp_mark_forum_read (   $user,
  $forumid,
  $groupid = false 
)

Marks a whole forum as read, for a given user.

@global object

Parameters
object$user
int$forumid
int | bool$groupid
Return values
bool

◆ forum_tp_mark_post_read()

forum_tp_mark_post_read (   $userid,
  $post,
  $unused = null 
)

If its an old post, do nothing.

If the record exists, the maintenance will clear it up later.

Parameters
int$useridThe ID of the user to mark posts read for.
object$postThe post record for the post to mark as read.
mixed$unused
Return values
bool

◆ forum_tp_mark_posts_read()

object forum_tp_mark_posts_read (   $user,
  $postids 
)

Mark posts as read.

@global object

Parameters
object$userobject
array$postidsarray of post ids
Return values
booleansuccess

◆ forum_tp_start_tracking()

object forum_tp_start_tracking (   $forumid,
  $userid = false 
)

@global object

Parameters
int$forumid
int$userid

◆ forum_tp_stop_tracking()

object forum_tp_stop_tracking (   $forumid,
  $userid = false 
)

@global object

Parameters
int$forumid
int$userid

◆ forum_trigger_content_uploaded_event()

forum_trigger_content_uploaded_event (   $post,
  $cm,
  $name 
)

Sends post content to plagiarism plugin.

Parameters
object$postForum post object
object$cmCourse-module
string$name
Return values
bool

◆ forum_trigger_post_updated_event()

forum_trigger_post_updated_event (   $post,
  $discussion,
  $context,
  $forum 
)

Trigger post updated event.

Parameters
object$postforum post object
object$discussiondiscussion object
object$contextforum context object
object$forumforum object
Since
Moodle 3.8
Return values
void

◆ forum_unsubscribe()

forum_unsubscribe ( )
Deprecated:
since Moodle 2.8 use mod_forum\subscriptions::unsubscribe_user() instead

◆ forum_update_calendar()

forum_update_calendar (   $forum,
  $cmid 
)

Update the calendar entries for this forum activity.

Parameters
stdClass$forumthe row from the database table forum.
int$cmidThe coursemodule id
Return values
bool

◆ forum_update_grades()

forum_update_grades (   $forum,
  $userid = 0 
)

Update activity grades.

Parameters
object$forum
int$useridspecific user only, 0 means all

◆ forum_update_instance()

object forum_update_instance (   $forum,
  $mform 
)

Given an object containing all the necessary data, (defined by the form in mod_form.php) this function will update an existing instance with new data.

Parameters
object$forumforum instance (with magic quotes)
Return values
boolsuccess

◆ forum_update_post()

forum_update_post (   $newpost,
  $mform,
  $unused = null 
)

Update a post.

Parameters
stdClass$newpostThe post to update
mixed$mformThe submitted form
string$unused
Return values
bool

◆ forum_update_subscriptions_button()

object forum_update_subscriptions_button (   $courseid,
  $forumid 
)

Prints the editing button on subscribers page.

@global object

Parameters
int$courseid
int$forumid
Return values
string

◆ forum_user_can_post()

object forum_user_can_post (   $forum,
  $discussion,
  $user = NULL,
  $cm = NULL,
  $course = NULL,
  $context = NULL 
)

This function checks whether the user can reply to posts in a forum discussion.

Use forum_user_can_post_discussion() to check whether the user can start discussions.

@global object @uses DEBUG_DEVELOPER @uses CONTEXT_MODULE @uses VISIBLEGROUPS

Parameters
object$forumforum object
object$discussion
object$user
object$cm
object$course
object$context
Return values
bool

◆ forum_user_can_post_discussion()

object forum_user_can_post_discussion (   $forum,
  $currentgroup = null,
  $unused = -1,
  $cm = NULL,
  $context = NULL 
)
Parameters
object$forum
object$currentgroup
int$unused
object$cm
object$context
Return values
bool

◆ forum_user_can_reply_privately()

forum_user_can_reply_privately ( \context_module  $context,
stdClass  $parent 
)

Check whether the user can reply privately to the parent post.

Parameters
context_module$context
stdClass$parent
Return values
bool

◆ forum_user_can_see_discussion()

object forum_user_can_see_discussion (   $forum,
  $discussion,
  $context,
  $user = NULL 
)

@global object @uses DEBUG_DEVELOPER

Parameters
object$forum
object$discussion
object$context
object$user
Return values
bool

◆ forum_user_can_see_group_discussion()

forum_user_can_see_group_discussion (   $discussion,
  $cm,
  $context 
)

Check to ensure a user can view a group discussion.

Parameters
object$discussion
object$cm
object$context
Return values
booleanreturns true if they can view post, false otherwise

◆ forum_user_can_see_post()

forum_user_can_see_post (   $forum,
  $discussion,
  $post,
  $user = null,
  $cm = null,
  $checkdeleted = true 
)

Check whether a user can see the specified post.

Parameters
stdClass$forumThe forum to chcek
stdClass$discussionThe discussion the post is in
stdClass$postThe post in question
stdClass$userThe user to test - if not specified, the current user is checked.
stdClass$cmThe Course Module that the forum is in (required).
bool$checkdeletedWhether to check the deleted flag on the post.
Return values
bool

◆ forum_user_can_see_timed_discussion()

forum_user_can_see_timed_discussion (   $discussion,
  $user,
  $context 
)

Check to ensure a user can view a timed discussion.

Parameters
object$discussion
object$user
object$context
Return values
booleanreturns true if they can view post, false otherwise

◆ forum_user_can_view_post()

forum_user_can_view_post ( )
Deprecated:
since Moodle 2.4 use forum_user_can_see_post() instead

◆ forum_user_complete()

object forum_user_complete (   $course,
  $user,
  $mod,
  $forum 
)

@global object

Parameters
object$coure
object$user
object$mod
object$forum

◆ forum_user_enrolled()

forum_user_enrolled ( )
Deprecated:
since Moodle 2.3 MDL-33166 - please do not use this function any more.

◆ forum_user_has_posted()

object forum_user_has_posted (   $forumid,
  $did,
  $userid 
)

@global object

Parameters
int$forumid
int$did
int$userid
Return values
bool

◆ forum_user_has_posted_discussion()

forum_user_has_posted_discussion (   $forumid,
  $userid,
  $groupid = null 
)

Returns true if user created new discussion already.

Parameters
int$forumidThe forum to check for postings
int$useridThe user to check for postings
int$groupidThe group to restrict the check to
Return values
bool

◆ forum_user_outline()

forum_user_outline (   $course,
  $user,
  $mod,
  $forum 
)
Parameters
object$course
object$user
object$modTODO this is not used in this function, refactor
object$forum
Return values
objectA standard object with 2 variables: info (number of posts for this user) and time (last modified)

◆ forum_view()

forum_view (   $forum,
  $course,
  $cm,
  $context 
)

Mark the activity completed (if required) and trigger the course_module_viewed event.

Parameters
stdClass$forumforum object
stdClass$coursecourse object
stdClass$cmcourse module object
stdClass$contextcontext object
Since
Moodle 2.9

◆ mod_forum_core_calendar_event_action_shows_item_count()

mod_forum_core_calendar_event_action_shows_item_count ( calendar_event  $event,
  $itemcount = 0 
)

Callback function that determines whether an action event should be showing its item count based on the event type and the item count.

Parameters
calendar_event$eventThe calendar event.
int$itemcountThe item count associated with the action event.
Return values
bool

◆ mod_forum_core_calendar_event_timestart_updated()

mod_forum_core_calendar_event_timestart_updated ( \calendar_event  $event,
stdClass  $forum 
)

This function will update the forum module according to the event that has been modified.

It will set the timeclose value of the forum instance according to the type of event provided.

Exceptions
moodle_exception
Parameters
calendar_event$event
stdClass$forumThe module instance to get the range from

◆ mod_forum_core_calendar_get_valid_event_timestart_range()

mod_forum_core_calendar_get_valid_event_timestart_range ( \calendar_event  $event,
stdClass  $forum 
)

This function calculates the minimum and maximum cutoff values for the timestart of the given event.

It will return an array with two values, the first being the minimum cutoff value and the second being the maximum cutoff value. Either or both values can be null, which indicates there is no minimum or maximum, respectively.

If a cutoff is required then the function must return an array containing the cutoff timestamp and error string to display to the user if the cutoff value is violated.

A minimum and maximum cutoff return value will look like: [ [1505704373, 'The date must be after this date'], [1506741172, 'The date must be before this date'] ]

Parameters
calendar_event$eventThe calendar event to get the time range for
stdClass$forumThe module instance to get the range from
Return values
arrayReturns an array with min and max date.

◆ mod_forum_core_calendar_provide_event_action()

mod_forum_core_calendar_provide_event_action ( calendar_event  $event,
core_calendar\action_factory  $factory,
int  $userid = 0 
)

This function receives a calendar event and returns the action associated with it, or null if there is none.

This is used by block_myoverview in order to display the event appropriately. If null is returned then the event is not displayed on the block.

Parameters
calendar_event$event
core_calendar\action_factory$factory
int$useridUser id to use for all capability checks, etc. Set to 0 for current user (default).
Return values
core_calendar

◆ mod_forum_count_all_discussions()

mod_forum_count_all_discussions ( \mod_forum\local\entities\forum  $forum,
stdClass  $user,
?int  $groupid 
)

Get a count of all discussions in a forum.

Parameters
mod_forum\local\entities\forum$forumThe forum entity
stdClass$userThe user to render for
int$groupidThe group to render
Return values
intThe number of discussions in a forum

◆ mod_forum_get_completion_active_rule_descriptions()

mod_forum_get_completion_active_rule_descriptions (   $cm)

Callback which returns human-readable strings describing the active completion custom rules for the module instance.

Parameters
cm_info | stdClass$cmobject with fields ->completion and ->customdata['customcompletionrules']
Return values
array::$descriptionsthe array of descriptions for the custom rules.

◆ mod_forum_get_discussion_summaries()

mod_forum_get_discussion_summaries ( \mod_forum\local\entities\forum  $forum,
stdClass  $user,
?int  $groupid,
?int  $sortorder,
?int  $pageno = 0,
?int  $pagesize = 0 
)

Fetch the data used to display the discussions on the current page.

Parameters
mod_forum\local\entities\forum$forumThe forum entity
stdClass$userThe user to render for
int[] | null$groupidThe group to render
int | null$sortorderThe sort order to use when selecting the discussions in the list
int | null$pagenoThe zero-indexed page number to use
int | null$pagesizeThe number of discussions to show on the page
Return values
arrayThe data to use for display

◆ mod_forum_get_fontawesome_icon_map()

mod_forum_get_fontawesome_icon_map ( )

Get icon mapping for font-awesome.

Return values
array

◆ mod_forum_get_groups_from_groupid()

mod_forum_get_groups_from_groupid ( \mod_forum\local\entities\forum  $forum,
stdClass  $user,
?int  $groupid 
)

Get the list of groups to show based on the current user and requested groupid.

Parameters
mod_forum\local\entities\forum$forumThe forum entity
stdClass$userThe user viewing
int$groupidThe groupid requested
Return values
arrayThe list of groups to show

◆ mod_forum_get_tagged_posts()

mod_forum_get_tagged_posts (   $tag,
  $exclusivemode = false,
  $fromctx = 0,
  $ctx = 0,
  $rec = 1,
  $page = 0 
)

Returns forum posts tagged with a specified tag.

This is a callback used by the tag area mod_forum/forum_posts to search for forum posts tagged with a specific tag.

Parameters
core_tag_tag$tag
bool$exclusivemodeif set to true it means that no other entities tagged with this tag are displayed on the page and the per-page limit may be bigger
int$fromctxcontext id where the link was displayed, may be used by callbacks to display items in the same context first
int$ctxcontext id where to search for records
bool$recsearch in subcontexts as well
int$page0-based number of page being displayed
Return values
core_tag

◆ mod_forum_inplace_editable()

mod_forum_inplace_editable (   $itemtype,
  $itemid,
  $newvalue 
)

Manage inplace editable saves.

Parameters
string$itemtypeThe type of item.
int$itemidThe ID of the item.
mixed$newvalueThe new value
Return values
string

◆ mod_forum_myprofile_navigation()

mod_forum_myprofile_navigation ( core_user\output\myprofile\tree  $tree,
  $user,
  $iscurrentuser,
  $course 
)

Add nodes to myprofile page.

Parameters
core_user\output\myprofile\tree$treeTree object
stdClass$useruser object
bool$iscurrentuser
stdClass$courseCourse object
Return values
bool

◆ mod_forum_rating_can_see_item_ratings()

mod_forum_rating_can_see_item_ratings (   $params)

Can the current user see ratings for a given itemid?

Parameters
array$paramssubmitted data contextid => int contextid [required] component => The component for this module - should always be mod_forum [required] ratingarea => object the context in which the rated items exists [required] itemid => int the ID of the object being rated [required] scaleid => int scale id [optional]
Return values
bool
Exceptions
coding_exception
rating_exception

◆ mod_forum_user_preferences()

mod_forum_user_preferences ( )

Return a list of all the user preferences used by mod_forum.

Return values
array

Variable Documentation

◆ $definitions

$definitions
Initial value:
= [
'forum_is_tracked' => [
'simplekeys' => true,
'simpledata' => true,
'staticacceleration' => true
],
]

◆ $handlers

$handlers
Initial value:
= array(
array(
'classname' => '\mod_forum\message\inbound\reply_handler',
),
)

◆ $logs

$logs
Initial value:
= array(
array('module' => 'forum', 'action' => 'add', 'mtable' => 'forum', 'field' => 'name'),
array('module' => 'forum', 'action' => 'update', 'mtable' => 'forum', 'field' => 'name'),
array('module' => 'forum', 'action' => 'add discussion', 'mtable' => 'forum_discussions', 'field' => 'name'),
array('module' => 'forum', 'action' => 'add post', 'mtable' => 'forum_posts', 'field' => 'subject'),
array('module' => 'forum', 'action' => 'update post', 'mtable' => 'forum_posts', 'field' => 'subject'),
array('module' => 'forum', 'action' => 'user report', 'mtable' => 'user',
'field' => $DB->sql_concat('firstname', "' '", 'lastname')),
array('module' => 'forum', 'action' => 'move discussion', 'mtable' => 'forum_discussions', 'field' => 'name'),
array('module' => 'forum', 'action' => 'view subscribers', 'mtable' => 'forum', 'field' => 'name'),
array('module' => 'forum', 'action' => 'view discussion', 'mtable' => 'forum_discussions', 'field' => 'name'),
array('module' => 'forum', 'action' => 'view forum', 'mtable' => 'forum', 'field' => 'name'),
array('module' => 'forum', 'action' => 'subscribe', 'mtable' => 'forum', 'field' => 'name'),
array('module' => 'forum', 'action' => 'unsubscribe', 'mtable' => 'forum', 'field' => 'name'),
array('module' => 'forum', 'action' => 'pin discussion', 'mtable' => 'forum_discussions', 'field' => 'name'),
array('module' => 'forum', 'action' => 'unpin discussion', 'mtable' => 'forum_discussions', 'field' => 'name'),
)

◆ $messageproviders

$messageproviders
Initial value:
= array (
'posts' => array(
'defaults' => array(
'airnotifier' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_LOGGEDIN + MESSAGE_DEFAULT_LOGGEDOFF,
),
),
'digests' => array(
),
)

◆ $observers

$observers
Initial value:
= array(
array(
'eventname' => '\core\event\user_enrolment_deleted',
'callback' => 'mod_forum_observer::user_enrolment_deleted',
),
array(
'eventname' => '\core\event\role_assigned',
'callback' => 'mod_forum_observer::role_assigned'
),
array(
'eventname' => '\core\event\course_module_created',
'callback' => 'mod_forum_observer::course_module_created',
),
array(
'eventname' => '\core\event\course_created',
'callback' => 'mod_forum_observer::course_created',
),
array(
'eventname' => '\core\event\course_updated',
'callback' => 'mod_forum_observer::course_updated',
),
)

◆ $tagareas

$tagareas
Initial value:
= array(
array(
'itemtype' => 'forum_posts',
'component' => 'mod_forum',
'callback' => 'mod_forum_get_tagged_posts',
'callbackfile' => '/mod/forum/locallib.php',
),
)

◆ $tasks

$tasks
Initial value:
= array(
array(
'classname' => 'mod_forum\task\cron_task',
'blocking' => 0,
'minute' => '*',
'hour' => '*',
'day' => '*',
'month' => '*',
'dayofweek' => '*'
)
)

◆ FORUM_MODE_FLATOLDEST

const FORUM_MODE_FLATOLDEST 1

Include required files.

CONSTANTS ///////////////////////////////////////////////////////////

◆ FORUM_TRACKING_FORCED

const FORUM_TRACKING_FORCED 2

FORUM_TRACKING_FORCED - Tracking is on, regardless of user setting.

Treated as FORUM_TRACKING_OPTIONAL if $CFG->forum_allowforcedreadtracking is off.

◆ FORUM_TRACKING_ON

const FORUM_TRACKING_ON 2

FORUM_TRACKING_ON - deprecated alias for FORUM_TRACKING_FORCED.

Deprecated:
since 2.6
$DB
global $DB
This file to be included so we can assume config.php has already been included.
Definition: tabs.php:31
MESSAGE_DEFAULT_LOGGEDIN
const MESSAGE_DEFAULT_LOGGEDIN
Define contants for messaging default settings population.
Definition: lib.php:44
cache_store\MODE_REQUEST
const MODE_REQUEST
Request caches.
Definition: store.php:146