blog MDL-23574 fixed filter problem with user blog rss feeds
authorAndrew Davis <andrew@affinitysoftware.net>
Fri, 30 Jul 2010 03:16:14 +0000 (03:16 +0000)
committerAndrew Davis <andrew@affinitysoftware.net>
Fri, 30 Jul 2010 03:16:14 +0000 (03:16 +0000)
blog/lib.php
blog/rsslib.php

index 3c2742b..b14644e 100755 (executable)
@@ -577,17 +577,17 @@ function blog_get_options_for_module(stdClass $module, stdClass $user=null) {
  *
  * @return array
  */
-function blog_get_headers() {
+function blog_get_headers($courseid=null, $groupid=null, $userid=null, $tagid=null) {
     global $CFG, $PAGE, $DB, $USER;
 
     $id       = optional_param('id', null, PARAM_INT);
     $tag      = optional_param('tag', null, PARAM_NOTAGS);
-    $tagid    = optional_param('tagid', null, PARAM_INT);
-    $userid   = optional_param('userid', null, PARAM_INT);
+    $tagid    = optional_param('tagid', $tagid, PARAM_INT);
+    $userid   = optional_param('userid', $userid, PARAM_INT);
     $modid    = optional_param('modid', null, PARAM_INT);
     $entryid  = optional_param('entryid', null, PARAM_INT);
-    $groupid  = optional_param('groupid', null, PARAM_INT);
-    $courseid = optional_param('courseid', null, PARAM_INT);
+    $groupid  = optional_param('groupid', $groupid, PARAM_INT);
+    $courseid = optional_param('courseid', $courseid, PARAM_INT);
     $search   = optional_param('search', null, PARAM_RAW);
     $action   = optional_param('action', null, PARAM_ALPHA);
     $confirm  = optional_param('confirm', false, PARAM_BOOL);
index 6e4f4f0..98bd4ee 100755 (executable)
@@ -113,7 +113,7 @@ function blog_rss_get_feed($context, $args) {
     }
 
     $type = $args[3];
-    $id = (int) $args[4];  // could be groupid / courseid  / userid  depending on $instance
+    $id = (int) $args[4];  // could be groupid / courseid  / userid  depending on $type
 
     $tagid=0;
     if ($args[5] != 'rss.xml') {
@@ -130,10 +130,26 @@ function blog_rss_get_feed($context, $args) {
         }
     }
 
+    $courseid = $groupid = $userid = null;
+    switch ($type) {
+        case 'site':
+            //$siteid = $id;
+            break;
+        case 'course':
+            $courseid = $id;
+            break;
+        case 'group':
+            $groupid = $id;
+            break;
+        case 'user':
+            $userid = $id;
+            break;
+    }
+
     // Get all the entries from the database
-    //$blogentries = blog_fetch_entries('', 20, '', $type, $id, $tagid);
     require_once($CFG->dirroot .'/blog/locallib.php');
-    $blogheaders = blog_get_headers();
+    $blogheaders = blog_get_headers($courseid, $groupid, $userid, $tagid);
+
     $bloglisting = new blog_listing($blogheaders['filters']);
     $blogentries = $bloglisting->get_entries();