MDL-46921 lib: Update get_all_user_name_fields() plus unit tests.
[moodle.git] / mod / forum / deprecatedlib.php
blob211ad81d87d757836e1ea6e276dde7f75f0c06c8
1 <?php
2 // This file is part of Moodle - http://moodle.org/
3 //
4 // Moodle is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // Moodle is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
17 /**
18 * @package mod_forum
19 * @copyright 2014 Andrew Robert Nicols <andrew@nicols.co.uk>
20 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23 defined('MOODLE_INTERNAL') || die();
25 // Deprecated a very long time ago.
27 /**
28 * How many posts by other users are unrated by a given user in the given discussion?
30 * @param int $discussionid
31 * @param int $userid
32 * @return mixed
33 * @deprecated since Moodle 1.1 - please do not use this function any more.
35 function forum_count_unrated_posts($discussionid, $userid) {
36 global $CFG, $DB;
37 debugging('forum_count_unrated_posts() is deprecated and will not be replaced.', DEBUG_DEVELOPER);
39 $sql = "SELECT COUNT(*) as num
40 FROM {forum_posts}
41 WHERE parent > 0
42 AND discussion = :discussionid
43 AND userid <> :userid";
44 $params = array('discussionid' => $discussionid, 'userid' => $userid);
45 $posts = $DB->get_record_sql($sql, $params);
46 if ($posts) {
47 $sql = "SELECT count(*) as num
48 FROM {forum_posts} p,
49 {rating} r
50 WHERE p.discussion = :discussionid AND
51 p.id = r.itemid AND
52 r.userid = userid AND
53 r.component = 'mod_forum' AND
54 r.ratingarea = 'post'";
55 $rated = $DB->get_record_sql($sql, $params);
56 if ($rated) {
57 if ($posts->num > $rated->num) {
58 return $posts->num - $rated->num;
59 } else {
60 return 0; // Just in case there was a counting error
62 } else {
63 return $posts->num;
65 } else {
66 return 0;
71 // Since Moodle 1.5.
73 /**
74 * Returns the count of records for the provided user and discussion.
76 * @global object
77 * @global object
78 * @param int $userid
79 * @param int $discussionid
80 * @return bool
81 * @deprecated since Moodle 1.5 - please do not use this function any more.
83 function forum_tp_count_discussion_read_records($userid, $discussionid) {
84 debugging('forum_tp_count_discussion_read_records() is deprecated and will not be replaced.', DEBUG_DEVELOPER);
86 global $CFG, $DB;
88 $cutoffdate = isset($CFG->forum_oldpostdays) ? (time() - ($CFG->forum_oldpostdays*24*60*60)) : 0;
90 $sql = 'SELECT COUNT(DISTINCT p.id) '.
91 'FROM {forum_discussions} d '.
92 'LEFT JOIN {forum_read} r ON d.id = r.discussionid AND r.userid = ? '.
93 'LEFT JOIN {forum_posts} p ON p.discussion = d.id '.
94 'AND (p.modified < ? OR p.id = r.postid) '.
95 'WHERE d.id = ? ';
97 return ($DB->count_records_sql($sql, array($userid, $cutoffdate, $discussionid)));
101 * Get all discussions started by a particular user in a course (or group)
103 * @global object
104 * @global object
105 * @param int $courseid
106 * @param int $userid
107 * @param int $groupid
108 * @return array
109 * @deprecated since Moodle 1.5 - please do not use this function any more.
111 function forum_get_user_discussions($courseid, $userid, $groupid=0) {
112 debugging('forum_get_user_discussions() is deprecated and will not be replaced.', DEBUG_DEVELOPER);
114 global $CFG, $DB;
115 $params = array($courseid, $userid);
116 if ($groupid) {
117 $groupselect = " AND d.groupid = ? ";
118 $params[] = $groupid;
119 } else {
120 $groupselect = "";
123 $allnames = get_all_user_name_fields(true, 'u');
124 return $DB->get_records_sql("SELECT p.*, d.groupid, $allnames, u.email, u.picture, u.imagealt,
125 f.type as forumtype, f.name as forumname, f.id as forumid
126 FROM {forum_discussions} d,
127 {forum_posts} p,
128 {user} u,
129 {forum} f
130 WHERE d.course = ?
131 AND p.discussion = d.id
132 AND p.parent = 0
133 AND p.userid = u.id
134 AND u.id = ?
135 AND d.forum = f.id $groupselect
136 ORDER BY p.created DESC", $params);
140 // Since Moodle 1.6.
143 * Returns the count of posts for the provided forum and [optionally] group.
144 * @global object
145 * @global object
146 * @param int $forumid
147 * @param int|bool $groupid
148 * @return int
149 * @deprecated since Moodle 1.6 - please do not use this function any more.
151 function forum_tp_count_forum_posts($forumid, $groupid=false) {
152 debugging('forum_tp_count_forum_posts() is deprecated and will not be replaced.', DEBUG_DEVELOPER);
154 global $CFG, $DB;
155 $params = array($forumid);
156 $sql = 'SELECT COUNT(*) '.
157 'FROM {forum_posts} fp,{forum_discussions} fd '.
158 'WHERE fd.forum = ? AND fp.discussion = fd.id';
159 if ($groupid !== false) {
160 $sql .= ' AND (fd.groupid = ? OR fd.groupid = -1)';
161 $params[] = $groupid;
163 $count = $DB->count_records_sql($sql, $params);
166 return $count;
170 * Returns the count of records for the provided user and forum and [optionally] group.
171 * @global object
172 * @global object
173 * @param int $userid
174 * @param int $forumid
175 * @param int|bool $groupid
176 * @return int
177 * @deprecated since Moodle 1.6 - please do not use this function any more.
179 function forum_tp_count_forum_read_records($userid, $forumid, $groupid=false) {
180 debugging('forum_tp_count_forum_read_records() is deprecated and will not be replaced.', DEBUG_DEVELOPER);
182 global $CFG, $DB;
184 $cutoffdate = time() - ($CFG->forum_oldpostdays*24*60*60);
186 $groupsel = '';
187 $params = array($userid, $forumid, $cutoffdate);
188 if ($groupid !== false) {
189 $groupsel = "AND (d.groupid = ? OR d.groupid = -1)";
190 $params[] = $groupid;
193 $sql = "SELECT COUNT(p.id)
194 FROM {forum_posts} p
195 JOIN {forum_discussions} d ON d.id = p.discussion
196 LEFT JOIN {forum_read} r ON (r.postid = p.id AND r.userid= ?)
197 WHERE d.forum = ?
198 AND (p.modified < $cutoffdate OR (p.modified >= ? AND r.id IS NOT NULL))
199 $groupsel";
201 return $DB->get_field_sql($sql, $params);
205 // Since Moodle 1.7.
208 * Returns array of forum open modes.
210 * @return array
211 * @deprecated since Moodle 1.7 - please do not use this function any more.
213 function forum_get_open_modes() {
214 debugging('forum_get_open_modes() is deprecated and will not be replaced.', DEBUG_DEVELOPER);
215 return array();
219 // Since Moodle 1.9.
222 * Gets posts with all info ready for forum_print_post
223 * We pass forumid in because we always know it so no need to make a
224 * complicated join to find it out.
226 * @global object
227 * @global object
228 * @param int $parent
229 * @param int $forumid
230 * @return array
231 * @deprecated since Moodle 1.9 MDL-13303 - please do not use this function any more.
233 function forum_get_child_posts($parent, $forumid) {
234 debugging('forum_get_child_posts() is deprecated.', DEBUG_DEVELOPER);
236 global $CFG, $DB;
238 $allnames = get_all_user_name_fields(true, 'u');
239 return $DB->get_records_sql("SELECT p.*, $forumid AS forum, $allnames, u.email, u.picture, u.imagealt
240 FROM {forum_posts} p
241 LEFT JOIN {user} u ON p.userid = u.id
242 WHERE p.parent = ?
243 ORDER BY p.created ASC", array($parent));
247 * Gets posts with all info ready for forum_print_post
248 * We pass forumid in because we always know it so no need to make a
249 * complicated join to find it out.
251 * @global object
252 * @global object
253 * @return mixed array of posts or false
254 * @deprecated since Moodle 1.9 MDL-13303 - please do not use this function any more.
256 function forum_get_discussion_posts($discussion, $sort, $forumid) {
257 debugging('forum_get_discussion_posts() is deprecated.', DEBUG_DEVELOPER);
259 global $CFG, $DB;
261 $allnames = get_all_user_name_fields(true, 'u');
262 return $DB->get_records_sql("SELECT p.*, $forumid AS forum, $allnames, u.email, u.picture, u.imagealt
263 FROM {forum_posts} p
264 LEFT JOIN {user} u ON p.userid = u.id
265 WHERE p.discussion = ?
266 AND p.parent > 0 $sort", array($discussion));
270 // Since Moodle 2.0.
273 * Returns a list of ratings for a particular post - sorted.
275 * @param stdClass $context
276 * @param int $postid
277 * @param string $sort
278 * @return array Array of ratings or false
279 * @deprecated since Moodle 2.0 MDL-21657 - please do not use this function any more.
281 function forum_get_ratings($context, $postid, $sort = "u.firstname ASC") {
282 debugging('forum_get_ratings() is deprecated.', DEBUG_DEVELOPER);
283 $options = new stdClass;
284 $options->context = $context;
285 $options->component = 'mod_forum';
286 $options->ratingarea = 'post';
287 $options->itemid = $postid;
288 $options->sort = "ORDER BY $sort";
290 $rm = new rating_manager();
291 return $rm->get_all_ratings_for_item($options);
295 * Generate and return the track or no track link for a forum.
297 * @global object
298 * @global object
299 * @global object
300 * @param object $forum the forum. Fields used are $forum->id and $forum->forcesubscribe.
301 * @param array $messages
302 * @param bool $fakelink
303 * @return string
304 * @deprecated since Moodle 2.0 MDL-14632 - please do not use this function any more.
306 function forum_get_tracking_link($forum, $messages=array(), $fakelink=true) {
307 debugging('forum_get_tracking_link() is deprecated.', DEBUG_DEVELOPER);
309 global $CFG, $USER, $PAGE, $OUTPUT;
311 static $strnotrackforum, $strtrackforum;
313 if (isset($messages['trackforum'])) {
314 $strtrackforum = $messages['trackforum'];
316 if (isset($messages['notrackforum'])) {
317 $strnotrackforum = $messages['notrackforum'];
319 if (empty($strtrackforum)) {
320 $strtrackforum = get_string('trackforum', 'forum');
322 if (empty($strnotrackforum)) {
323 $strnotrackforum = get_string('notrackforum', 'forum');
326 if (forum_tp_is_tracked($forum)) {
327 $linktitle = $strnotrackforum;
328 $linktext = $strnotrackforum;
329 } else {
330 $linktitle = $strtrackforum;
331 $linktext = $strtrackforum;
334 $link = '';
335 if ($fakelink) {
336 $PAGE->requires->js('/mod/forum/forum.js');
337 $PAGE->requires->js_function_call('forum_produce_tracking_link', Array($forum->id, $linktext, $linktitle));
338 // use <noscript> to print button in case javascript is not enabled
339 $link .= '<noscript>';
341 $url = new moodle_url('/mod/forum/settracking.php', array('id'=>$forum->id));
342 $link .= $OUTPUT->single_button($url, $linktext, 'get', array('title'=>$linktitle));
344 if ($fakelink) {
345 $link .= '</noscript>';
348 return $link;
352 * Returns the count of records for the provided user and discussion.
354 * @global object
355 * @global object
356 * @param int $userid
357 * @param int $discussionid
358 * @return int
359 * @deprecated since Moodle 2.0 MDL-14113 - please do not use this function any more.
361 function forum_tp_count_discussion_unread_posts($userid, $discussionid) {
362 debugging('forum_tp_count_discussion_unread_posts() is deprecated.', DEBUG_DEVELOPER);
363 global $CFG, $DB;
365 $cutoffdate = isset($CFG->forum_oldpostdays) ? (time() - ($CFG->forum_oldpostdays*24*60*60)) : 0;
367 $sql = 'SELECT COUNT(p.id) '.
368 'FROM {forum_posts} p '.
369 'LEFT JOIN {forum_read} r ON r.postid = p.id AND r.userid = ? '.
370 'WHERE p.discussion = ? '.
371 'AND p.modified >= ? AND r.id is NULL';
373 return $DB->count_records_sql($sql, array($userid, $discussionid, $cutoffdate));
377 * Converts a forum to use the Roles System
379 * @deprecated since Moodle 2.0 MDL-23479 - please do not use this function any more.
381 function forum_convert_to_roles() {
382 debugging('forum_convert_to_roles() is deprecated and will not be replaced.', DEBUG_DEVELOPER);
386 * Returns all records in the 'forum_read' table matching the passed keys, indexed
387 * by userid.
389 * @global object
390 * @param int $userid
391 * @param int $postid
392 * @param int $discussionid
393 * @param int $forumid
394 * @return array
395 * @deprecated since Moodle 2.0 MDL-14113 - please do not use this function any more.
397 function forum_tp_get_read_records($userid=-1, $postid=-1, $discussionid=-1, $forumid=-1) {
398 debugging('forum_tp_get_read_records() is deprecated and will not be replaced.', DEBUG_DEVELOPER);
400 global $DB;
401 $select = '';
402 $params = array();
404 if ($userid > -1) {
405 if ($select != '') $select .= ' AND ';
406 $select .= 'userid = ?';
407 $params[] = $userid;
409 if ($postid > -1) {
410 if ($select != '') $select .= ' AND ';
411 $select .= 'postid = ?';
412 $params[] = $postid;
414 if ($discussionid > -1) {
415 if ($select != '') $select .= ' AND ';
416 $select .= 'discussionid = ?';
417 $params[] = $discussionid;
419 if ($forumid > -1) {
420 if ($select != '') $select .= ' AND ';
421 $select .= 'forumid = ?';
422 $params[] = $forumid;
425 return $DB->get_records_select('forum_read', $select, $params);
429 * Returns all read records for the provided user and discussion, indexed by postid.
431 * @global object
432 * @param inti $userid
433 * @param int $discussionid
434 * @deprecated since Moodle 2.0 MDL-14113 - please do not use this function any more.
436 function forum_tp_get_discussion_read_records($userid, $discussionid) {
437 debugging('forum_tp_get_discussion_read_records() is deprecated and will not be replaced.', DEBUG_DEVELOPER);
439 global $DB;
440 $select = 'userid = ? AND discussionid = ?';
441 $fields = 'postid, firstread, lastread';
442 return $DB->get_records_select('forum_read', $select, array($userid, $discussionid), '', $fields);
445 // Deprecated in 2.3.
448 * This function gets run whenever user is enrolled into course
450 * @deprecated since Moodle 2.3 MDL-33166 - please do not use this function any more.
451 * @param stdClass $cp
452 * @return void
454 function forum_user_enrolled($cp) {
455 debugging('forum_user_enrolled() is deprecated. Please use forum_user_role_assigned instead.', DEBUG_DEVELOPER);
456 global $DB;
458 // NOTE: this has to be as fast as possible - we do not want to slow down enrolments!
459 // Originally there used to be 'mod/forum:initialsubscriptions' which was
460 // introduced because we did not have enrolment information in earlier versions...
462 $sql = "SELECT f.id
463 FROM {forum} f
464 LEFT JOIN {forum_subscriptions} fs ON (fs.forum = f.id AND fs.userid = :userid)
465 WHERE f.course = :courseid AND f.forcesubscribe = :initial AND fs.id IS NULL";
466 $params = array('courseid'=>$cp->courseid, 'userid'=>$cp->userid, 'initial'=>FORUM_INITIALSUBSCRIBE);
468 $forums = $DB->get_records_sql($sql, $params);
469 foreach ($forums as $forum) {
470 \mod_forum\subscriptions::subscribe_user($cp->userid, $forum);
475 // Deprecated in 2.4.
478 * Checks to see if a user can view a particular post.
480 * @deprecated since Moodle 2.4 use forum_user_can_see_post() instead
482 * @param object $post
483 * @param object $course
484 * @param object $cm
485 * @param object $forum
486 * @param object $discussion
487 * @param object $user
488 * @return boolean
490 function forum_user_can_view_post($post, $course, $cm, $forum, $discussion, $user=null){
491 debugging('forum_user_can_view_post() is deprecated. Please use forum_user_can_see_post() instead.', DEBUG_DEVELOPER);
492 return forum_user_can_see_post($forum, $discussion, $post, $user, $cm);
496 // Deprecated in 2.6.
499 * FORUM_TRACKING_ON - deprecated alias for FORUM_TRACKING_FORCED.
500 * @deprecated since 2.6
502 define('FORUM_TRACKING_ON', 2);
505 * @deprecated since Moodle 2.6
506 * @see shorten_text()
508 function forum_shorten_post($message) {
509 throw new coding_exception('forum_shorten_post() can not be used any more. Please use shorten_text($message, $CFG->forum_shortpost) instead.');
512 // Deprecated in 2.8.
515 * @global object
516 * @param int $userid
517 * @param object $forum
518 * @return bool
519 * @deprecated since Moodle 2.8 use \mod_forum\subscriptions::is_subscribed() instead
521 function forum_is_subscribed($userid, $forum) {
522 global $DB;
523 debugging("forum_is_subscribed() has been deprecated, please use \\mod_forum\\subscriptions::is_subscribed() instead.",
524 DEBUG_DEVELOPER);
526 // Note: The new function does not take an integer form of forum.
527 if (is_numeric($forum)) {
528 $forum = $DB->get_record('forum', array('id' => $forum));
531 return mod_forum\subscriptions::is_subscribed($userid, $forum);
535 * Adds user to the subscriber list
537 * @param int $userid
538 * @param int $forumid
539 * @param context_module|null $context Module context, may be omitted if not known or if called for the current module set in page.
540 * @param boolean $userrequest Whether the user requested this change themselves. This has an effect on whether
541 * discussion subscriptions are removed too.
542 * @deprecated since Moodle 2.8 use \mod_forum\subscriptions::subscribe_user() instead
544 function forum_subscribe($userid, $forumid, $context = null, $userrequest = false) {
545 global $DB;
546 debugging("forum_subscribe() has been deprecated, please use \\mod_forum\\subscriptions::subscribe_user() instead.",
547 DEBUG_DEVELOPER);
549 // Note: The new function does not take an integer form of forum.
550 $forum = $DB->get_record('forum', array('id' => $forumid));
551 \mod_forum\subscriptions::subscribe_user($userid, $forum, $context, $userrequest);
555 * Removes user from the subscriber list
557 * @param int $userid
558 * @param int $forumid
559 * @param context_module|null $context Module context, may be omitted if not known or if called for the current module set in page.
560 * @param boolean $userrequest Whether the user requested this change themselves. This has an effect on whether
561 * discussion subscriptions are removed too.
562 * @deprecated since Moodle 2.8 use \mod_forum\subscriptions::unsubscribe_user() instead
564 function forum_unsubscribe($userid, $forumid, $context = null, $userrequest = false) {
565 global $DB;
566 debugging("forum_unsubscribe() has been deprecated, please use \\mod_forum\\subscriptions::unsubscribe_user() instead.",
567 DEBUG_DEVELOPER);
569 // Note: The new function does not take an integer form of forum.
570 $forum = $DB->get_record('forum', array('id' => $forumid));
571 \mod_forum\subscriptions::unsubscribe_user($userid, $forum, $context, $userrequest);
575 * Returns list of user objects that are subscribed to this forum.
577 * @param stdClass $course the course
578 * @param stdClass $forum the forum
579 * @param int $groupid group id, or 0 for all.
580 * @param context_module $context the forum context, to save re-fetching it where possible.
581 * @param string $fields requested user fields (with "u." table prefix)
582 * @param boolean $considerdiscussions Whether to take discussion subscriptions and unsubscriptions into consideration.
583 * @return array list of users.
584 * @deprecated since Moodle 2.8 use \mod_forum\subscriptions::fetch_subscribed_users() instead
586 function forum_subscribed_users($course, $forum, $groupid = 0, $context = null, $fields = null) {
587 debugging("forum_subscribed_users() has been deprecated, please use \\mod_forum\\subscriptions::fetch_subscribed_users() instead.",
588 DEBUG_DEVELOPER);
590 \mod_forum\subscriptions::fetch_subscribed_users($forum, $groupid, $context, $fields);
594 * Determine whether the forum is force subscribed.
596 * @param object $forum
597 * @return bool
598 * @deprecated since Moodle 2.8 use \mod_forum\subscriptions::is_forcesubscribed() instead
600 function forum_is_forcesubscribed($forum) {
601 debugging("forum_is_forcesubscribed() has been deprecated, please use \\mod_forum\\subscriptions::is_forcesubscribed() instead.",
602 DEBUG_DEVELOPER);
604 global $DB;
605 if (!isset($forum->forcesubscribe)) {
606 $forum = $DB->get_field('forum', 'forcesubscribe', array('id' => $forum));
609 return \mod_forum\subscriptions::is_forcesubscribed($forum);
613 * Set the subscription mode for a forum.
615 * @param int $forumid
616 * @param mixed $value
617 * @return bool
618 * @deprecated since Moodle 2.8 use \mod_forum\subscriptions::set_subscription_mode() instead
620 function forum_forcesubscribe($forumid, $value = 1) {
621 debugging("forum_forcesubscribe() has been deprecated, please use \\mod_forum\\subscriptions::set_subscription_mode() instead.",
622 DEBUG_DEVELOPER);
624 return \mod_forum\subscriptions::set_subscription_mode($forumid, $value);
628 * Get the current subscription mode for the forum.
630 * @param int|stdClass $forumid
631 * @param mixed $value
632 * @return bool
633 * @deprecated since Moodle 2.8 use \mod_forum\subscriptions::get_subscription_mode() instead
635 function forum_get_forcesubscribed($forum) {
636 debugging("forum_get_forcesubscribed() has been deprecated, please use \\mod_forum\\subscriptions::get_subscription_mode() instead.",
637 DEBUG_DEVELOPER);
639 global $DB;
640 if (!isset($forum->forcesubscribe)) {
641 $forum = $DB->get_field('forum', 'forcesubscribe', array('id' => $forum));
644 return \mod_forum\subscriptions::get_subscription_mode($forumid, $value);
648 * Get a list of forums in the specified course in which a user can change
649 * their subscription preferences.
651 * @param stdClass $course The course from which to find subscribable forums.
652 * @return array
653 * @deprecated since Moodle 2.8 use \mod_forum\subscriptions::is_subscribed in combination wtih
654 * \mod_forum\subscriptions::fill_subscription_cache_for_course instead.
656 function forum_get_subscribed_forums($course) {
657 debugging("forum_get_subscribed_forums() has been deprecated, please see " .
658 "\\mod_forum\\subscriptions::is_subscribed::() " .
659 " and \\mod_forum\\subscriptions::fill_subscription_cache_for_course instead.",
660 DEBUG_DEVELOPER);
662 global $USER, $CFG, $DB;
663 $sql = "SELECT f.id
664 FROM {forum} f
665 LEFT JOIN {forum_subscriptions} fs ON (fs.forum = f.id AND fs.userid = ?)
666 WHERE f.course = ?
667 AND f.forcesubscribe <> ".FORUM_DISALLOWSUBSCRIBE."
668 AND (f.forcesubscribe = ".FORUM_FORCESUBSCRIBE." OR fs.id IS NOT NULL)";
669 if ($subscribed = $DB->get_records_sql($sql, array($USER->id, $course->id))) {
670 foreach ($subscribed as $s) {
671 $subscribed[$s->id] = $s->id;
673 return $subscribed;
674 } else {
675 return array();
680 * Returns an array of forums that the current user is subscribed to and is allowed to unsubscribe from
682 * @return array An array of unsubscribable forums
683 * @deprecated since Moodle 2.8 use \mod_forum\subscriptions::get_unsubscribable_forums() instead
685 function forum_get_optional_subscribed_forums() {
686 debugging("forum_get_optional_subscribed_forums() has been deprecated, please use \\mod_forum\\subscriptions::get_unsubscribable_forums() instead.",
687 DEBUG_DEVELOPER);
689 return \mod_forum\subscriptions::get_unsubscribable_forums();
693 * Get the list of potential subscribers to a forum.
695 * @param object $forumcontext the forum context.
696 * @param integer $groupid the id of a group, or 0 for all groups.
697 * @param string $fields the list of fields to return for each user. As for get_users_by_capability.
698 * @param string $sort sort order. As for get_users_by_capability.
699 * @return array list of users.
700 * @deprecated since Moodle 2.8 use \mod_forum\subscriptions::get_potential_subscribers() instead
702 function forum_get_potential_subscribers($forumcontext, $groupid, $fields, $sort = '') {
703 debugging("forum_get_potential_subscribers() has been deprecated, please use \\mod_forum\\subscriptions::get_potential_subscribers() instead.",
704 DEBUG_DEVELOPER);
706 \mod_forum\subscriptions::get_potential_subscribers($forumcontext, $groupid, $fields, $sort);