]> git.mjollnir.org Git - moodle.git/commitdiff
forum MDL-19808 Upgraded deprecated calls
authorsamhemelryk <samhemelryk>
Fri, 16 Oct 2009 03:20:23 +0000 (03:20 +0000)
committersamhemelryk <samhemelryk>
Fri, 16 Oct 2009 03:20:23 +0000 (03:20 +0000)
mod/forum/index.php
mod/forum/lib.php

index 41e22b6c6d0bdd0a91d8eab1c4cf0589dccf028f..e87771563299e3e74e7cf6401d1f8984451c09ed 100644 (file)
@@ -126,7 +126,7 @@ foreach ($modinfo->instances['forum'] as $forumid=>$cm) {
 }
 
 /// Do course wide subscribe/unsubscribe
-if (!is_null($subscribe) and !isguestuser() and !isguest()) {
+if (!is_null($subscribe) and !isguestuser()) {
     foreach ($modinfo->instances['forum'] as $forumid=>$cm) {
         $forum = $forums[$forumid];
         $modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
@@ -396,7 +396,7 @@ $PAGE->set_heading($course->fullname);
 $PAGE->set_button($searchform);
 echo $OUTPUT->header();
 
-if (!isguest()) {
+if (!isguestuser()) {
     echo $OUTPUT->box_start('subscription');
     echo '<span class="helplink">';
     echo '<a href="index.php?id='.$course->id.'&amp;subscribe=1">'.get_string('allsubscribe', 'forum').'</a>';
index e80028e232e6657fcbaeaec40501a81a7babd52f..82463152cc3c92b6335abfee5b5d856804e39af4 100644 (file)
@@ -1178,7 +1178,7 @@ function forum_user_complete($course, $user, $mod, $forum) {
  * @param array $htmlarray
  */
 function forum_print_overview($courses,&$htmlarray) {
-    global $USER, $CFG, $DB;
+    global $USER, $CFG, $DB, $SESSION;
 
     $LIKE = $DB->sql_ilike();
 
@@ -1231,7 +1231,18 @@ function forum_print_overview($courses,&$htmlarray) {
         foreach ($trackingforums as $track) {
             $sql .= '(d.forum = ? AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = ?)) OR ';
             $params[] = $track->id;
-            $params[] = get_current_group($track->course);
+            if (isset($SESSION->currentgroup[$track->course])) {
+                $groupid =  $SESSION->currentgroup[$track->course];
+            } else {
+                $groupid = groups_get_all_groups($track->course, $USER->id);
+                if (is_array($groupid)) {
+                    $groupid = array_shift(array_keys($groupid));
+                    $SESSION->currentgroup[$track->course] = $groupid;
+                } else {
+                    $groupid = 0;
+                }
+            }
+            $params[] = $groupid;
         }
         $sql = substr($sql,0,-3); // take off the last OR
         $sql .= ') AND p.modified >= ? AND r.id is NULL GROUP BY d.forum,d.course';