From 30e1a2ee559af85424c74bd9b944fb62c220bc23 Mon Sep 17 00:00:00 2001 From: martin Date: Sun, 16 Jun 2002 09:44:22 +0000 Subject: [PATCH] Changes to add subscribe/unsubscribe to site News forum --- index.php | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/index.php b/index.php index 7df04482d9..85ed014516 100644 --- a/index.php +++ b/index.php @@ -2,7 +2,9 @@ // index.php - the front page. require("config.php"); + include("course/lib.php"); include("mod/reading/lib.php"); + include("mod/discuss/lib.php"); if (! $site = get_record("course", "category", 0)) { redirect("$CFG->wwwroot/admin/"); @@ -61,14 +63,31 @@ format == 0 ) { print_simple_box("Available Courses", $align="CENTER", $width="100%", $color="$THEME->cellheading"); echo "\"\"
"; - include("course/lib.php"); print_all_courses(); } else { - print_simple_box("Site News", $align="CENTER", $width="100%", $color="$THEME->cellheading"); + if (! $newsforum = get_course_news_forum($site->id)) { + error("Could not find or create a main forum for the site"); + } + + if ($USER) { + $SESSION->fromdiscuss = "$CFG->wwwroot"; + if (is_subscribed($USER->id, $newsforum->id)) { + $subtext = "Unsubscribe from news"; + } else { + $subtext = "Subscribe me by mail"; + } + $headertext = " + +
Site News + id\">$subtext +
"; + } else { + $headertext = "Site News"; + } + print_simple_box("$headertext", $align="CENTER", $width="100%", $color="$THEME->cellheading"); echo "\"\"
"; - include("mod/discuss/lib.php"); - forum_latest_topics(0, $site->format); + forum_latest_topics($newsforum->id, $site->format); } ?> -- 2.39.5