Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added logic in function forum_get_recent_mod_activity for groups

  • Loading branch information...
commit 90708fc1f3175db73edcfcff619c3e1cfd1b17ef 1 parent 6a0c9cf
selliott authored
Showing with 24 additions and 27 deletions.
  1. +24 −27 mod/forum/lib.php
View
51 mod/forum/lib.php
@@ -2308,12 +2308,6 @@ function forum_get_recent_mod_activity(&$activities, &$index, $sincetime, $cours
$userselect = "";
}
- if ($groupid) {
- $groupselect = " AND d.groupid = '$groupid'";
- } else {
- $groupselect = "";
- }
-
$posts = get_records_sql("SELECT p.*, d.name, u.firstname, u.lastname,
u.picture, d.groupid, cm.instance, f.name, cm.section
FROM {$CFG->prefix}forum_posts p,
@@ -2331,32 +2325,35 @@ function forum_get_recent_mod_activity(&$activities, &$index, $sincetime, $cours
AND f.id = d.forum
ORDER BY d.id");
- if (empty($posts))
- return;
-
- foreach ($posts as $post) {
- $tmpactivity->type = "forum";
- $tmpactivity->defaultindex = $index;
- $tmpactivity->instance = $post->instance;
- $tmpactivity->name = $post->name;
- $tmpactivity->section = $post->section;
+ if (empty($posts))
+ return;
- $tmpactivity->content->id = $post->id;
- $tmpactivity->content->discussion = $post->discussion;
- $tmpactivity->content->subject = $post->subject;
- $tmpactivity->content->parent = $post->parent;
+ foreach ($posts as $post) {
- $tmpactivity->user->userid = $post->userid;
- $tmpactivity->user->fullname = fullname($post);
- $tmpactivity->user->picture = $post->picture;
+ if (empty($groupid) || ismember($groupid, $post->userid)) {
+ $tmpactivity->type = "forum";
+ $tmpactivity->defaultindex = $index;
+ $tmpactivity->instance = $post->instance;
+ $tmpactivity->name = $post->name;
+ $tmpactivity->section = $post->section;
- $tmpactivity->timestamp = $post->modified;
- $activities[] = $tmpactivity;
+ $tmpactivity->content->id = $post->id;
+ $tmpactivity->content->discussion = $post->discussion;
+ $tmpactivity->content->subject = $post->subject;
+ $tmpactivity->content->parent = $post->parent;
+
+ $tmpactivity->user->userid = $post->userid;
+ $tmpactivity->user->fullname = fullname($post);
+ $tmpactivity->user->picture = $post->picture;
- $index++;
- }
+ $tmpactivity->timestamp = $post->modified;
+ $activities[] = $tmpactivity;
+
+ $index++;
+ }
+ }
- return;
+ return;
}
function forum_print_recent_mod_activity($activity, $course, $detail=false) {
Please sign in to comment.
Something went wrong with that request. Please try again.