From 831ee213032623aefb9d40cc0ebb97234e56fa63 Mon Sep 17 00:00:00 2001 From: Kjartan Mannes Date: Fri, 7 Mar 2003 22:11:44 +0000 Subject: - Renamed "form.admin" to "form admin". - Added node_admin_settings() to let users set node defaults. * Added _nodeapi("conf") - Modified form_checkbox() to unset options. (Modified the patch from Ax.) - Removed the _save() hook. - Fixed a logical flaw in field_get() and field_set() which would break moderation. - Moved some admin menus around and cleaned up some typos. --- modules/forum/forum.module | 37 +++++++++++++------------------------ 1 file changed, 13 insertions(+), 24 deletions(-) (limited to 'modules/forum/forum.module') diff --git a/modules/forum/forum.module b/modules/forum/forum.module index 5b90e3145..80026a80d 100644 --- a/modules/forum/forum.module +++ b/modules/forum/forum.module @@ -69,24 +69,6 @@ function forum_taxonomy($op, $type, $object) { } } -function forum_save($op, $node) { - if ($op == "approve") { - return array("status" => 1); - } - - if ($op == "create") { - return array("body" => filter($node->body), "teaser" => filter($node->teaser), "moderate" => 0, "status" => 1, "tid", "icon_num", "shadow" => 0); - } - - if ($op == "decline") { - return array("status" => 0); - } - - if ($op == "update") { - return array("body" => filter($node->body), "teaser" => filter($node->teaser), "tid", "icon_num", "shadow"); - } -} - function forum_load($node) { $forum = db_fetch_object(db_query("SELECT * FROM forum WHERE nid = '%d'", $node->nid)); @@ -185,13 +167,20 @@ function forum_view($node, $main = 0) { theme("node", $node, $main); } -function forum_validate($node) { - // we use the validate hook to remember the old taxonomy terms - $node->taxonomy = array_keys(taxonomy_node_get_terms($node->nid)); - if (!in_array($node->tid[0], $node->taxonomy)) { - $node->taxonomy[] = $node->tid[0]; +function forum_validate(&$node) { + // Make sure all fields are set properly: + $node->body = filter($node->body); + $node->teaser = filter($node->teaser); + $node->icon = $node->icon ? $node->icon : ""; + $node->shadow = $node->shadow ? $node->shadow : 0; + $node->tid = $node->tid ? $node->tid : 0; + // We use the validate hook to remember the old taxonomy terms: + if ($node->tid) { + $node->taxonomy = array_keys(taxonomy_node_get_terms($node->nid)); + if (!in_array($node->tid[0], $node->taxonomy)) { + $node->taxonomy[] = $node->tid[0]; + } } - return $node; } function forum_form(&$node, &$help, &$error) { -- cgit v1.2.3