Teachers can now unsubscribe anyone from the "list of subscribers" list.

Made the feedback display when subscribing/unsubscribing a little more
generic.
This commit is contained in:
martin
2002-08-17 07:53:32 +00:00
parent 4efeb8c3e3
commit 3bc9bf9790
3 changed files with 24 additions and 7 deletions
+2 -2
View File
@@ -47,8 +47,8 @@ $string[nameteacher] = "Teacher forum";
$string[nodiscussions] = "There are no discussion topics yet in this forum";
$string[noposts] = "No posts";
$string[nosubscribers] = "There are no subscribers yet for this forum";
$string[nownotsubscribed] = "You are now NOT SUBSCRIBED to receive '\$a' by email.";
$string[nowsubscribed] = "You are now SUBSCRIBED to receive '\$a' by email.";
$string[nownotsubscribed] = "\$a->name will NOT receive copies of '\$a->forum' by email.";
$string[nowsubscribed] = "\$a->name will receive copies of '\$a->forum' by email.";
$string[numposts] = "\$a posts";
$string[olderdiscussions] = "Older discussions";
$string[parentofthispost] = "Parent of this post";
+20 -5
View File
@@ -7,6 +7,7 @@
require_variable($id); // The forum to subscribe or unsubscribe to
optional_variable($force); // Force everyone to be subscribed to this forum?
optional_variable($user); // Force everyone to be subscribed to this forum?
if (isguest()) {
error("Guests are not allowed to subscribe to posts.", $HTTP_REFERER);
@@ -20,6 +21,17 @@
error("Forum doesn't belong to a course!");
}
if ($user) {
if (!isteacher($course->id)) {
error("Only teachers can subscribe/unsubscribe other people!");
}
if (! $user = get_record("user", "id", $user)) {
error("User ID was incorrect");
}
} else {
$user = $USER;
}
if ($course->category) {
require_login($forum->course);
} else {
@@ -48,18 +60,21 @@
redirect($returnto, get_string("everyoneissubscribed", "forum"), 1);
}
if ( forum_is_subscribed($USER->id, $forum->id) ) {
if (forum_unsubscribe($USER->id, $forum->id) ) {
$info->name = "$user->firstname $user->lastname";
$info->forum = $forum->name;
if ( forum_is_subscribed($user->id, $forum->id) ) {
if (forum_unsubscribe($user->id, $forum->id) ) {
add_to_log($course->id, "forum", "unsubscribe", "view.php?f=$forum->id", "$forum->id");
redirect($returnto, get_string("nownotsubscribed", "forum", "$forum->name"), 1);
redirect($returnto, get_string("nownotsubscribed", "forum", $info), 1);
} else {
error("Could not unsubscribe you from that forum", "$HTTP_REFERER");
}
} else { // subscribe
if (forum_subscribe($USER->id, $forum->id) ) {
if (forum_subscribe($user->id, $forum->id) ) {
add_to_log($course->id, "forum", "subscribe", "view.php?f=$forum->id", "$forum->id");
redirect($returnto, get_string("nowsubscribed", "forum", "$forum->name"), 1);
redirect($returnto, get_string("nowsubscribed", "forum", $info), 1);
} else {
error("Could not subscribe you to that forum", "$HTTP_REFERER");
}
+2
View File
@@ -51,6 +51,8 @@
echo "$user->firstname $user->lastname";
echo "</TD><TD BGCOLOR=\"$THEME->cellcontent\">";
echo "$user->email";
echo "</TD><TD>";
echo "<FONT SIZE=1><A HREF=\"subscribe.php?id=$forum->id&user=$user->id\">unsubscribe</A></FONT>";
echo "</TD></TR>";
}
echo "</TABLE>";