]> git.mjollnir.org Git - moodle.git/commitdiff
This file is not linked to or used by anything yet, but I've found it
authormartin <martin>
Fri, 2 Aug 2002 09:19:22 +0000 (09:19 +0000)
committermartin <martin>
Fri, 2 Aug 2002 09:19:22 +0000 (09:19 +0000)
useful to delete forums properly while testing stuff.

mod/forum/delete.php [new file with mode: 0644]

diff --git a/mod/forum/delete.php b/mod/forum/delete.php
new file mode 100644 (file)
index 0000000..3eb2b60
--- /dev/null
@@ -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");
+?>