Permalink
Browse files

This file is not linked to or used by anything yet, but I've found it

useful to delete forums properly while testing stuff.
  • Loading branch information...
1 parent ef58b82 commit 238a826393f8cbd3be2c8b493185db5eccb36d7a martin committed Aug 2, 2002
Showing with 27 additions and 0 deletions.
  1. +27 −0 mod/forum/delete.php
View
27 mod/forum/delete.php
@@ -0,0 +1,27 @@
+<?PHP // $Id$
+
+// Deletes a forum entirely.
+
+ require("../../config.php");
+ require("mod.php");
+
+ require_variable($f); // The forum to delete.
+
+ if (! $forum = get_record("forum", "id", $f)) {
+ error("Forum ID was incorrect");
+ }
+
+ if (! $course = get_record("course", "id", $forum->course)) {
+ error("Forum course was incorrect");
+ }
+
+ if (!isteacher($forum->course)) {
+ error("You are not allowed to do this");
+ }
+
+ if (! delete_instance($forum->id)) {
+ error("Could not delete that forum");
+ }
+
+ redirect("$CFG->wwwroot/mod/forum/index.php?id=$course->id");
+?>

0 comments on commit 238a826

Please sign in to comment.