Browse files

Whoops! Hide teacher discussions when printing list of user discussions

  • Loading branch information...
1 parent 11b0c46 commit 4ca090910edf13da44c7ea19fc238cadc28b729a martin committed Aug 1, 2002
Showing with 7 additions and 3 deletions.
  1. +7 −3 mod/forum/lib.php
View
10 mod/forum/lib.php
@@ -437,17 +437,21 @@ function forum_delete_discussion($discussion) {
function forum_print_user_discussions($courseid, $userid) {
global $USER;
- $discussions = get_records_sql("SELECT p.*, u.firstname, u.lastname, u.email, u.picture, u.id as userid
- FROM forum_discussions d, forum_posts p, user u
+ $discussions = get_records_sql("SELECT p.*, u.firstname, u.lastname, u.email, u.picture, u.id as userid, f.type as forumtype
+ FROM forum_discussions d, forum_posts p, user u, forum f
WHERE d.course = '$courseid' AND p.discussion = d.id AND
- p.parent = 0 AND p.user = u.id AND u.id = '$userid'
+ p.parent = 0 AND p.user = u.id AND u.id = '$userid' AND
+ d.forum = f.id
ORDER BY p.created DESC");
if ($discussions) {
echo "<HR>";
print_heading("Discussion topics");
$replies = forum_count_discussion_replies();
foreach ($discussions as $discussion) {
+ if (($discussion->forumtype == "teacher") and !isteacher($courseid)) {
+ continue;
+ }
if ($replies[$discussion->discussion]) {
$discussion->replies = $replies[$discussion->discussion]->replies;
} else {

0 comments on commit 4ca0909

Please sign in to comment.