From dd329e1d95dcc0e02841482b660091945f433d13 Mon Sep 17 00:00:00 2001 From: Kjartan Mannes Date: Sun, 16 Feb 2003 14:57:35 +0000 Subject: - Added function node_invoke_all($hook, &$node, $op, $arg = 0). - Added a _nodeapi hook that in time will replace the _node hook. Trying to make as few changes to existing code as possible until the new api is stabilized. - Modified node_form() to add administration options from other modules using the _nodeapi hook. - Modified node_save() to fetch which fields should be saved to the node table from the _nodeapi hook. - Moved comment and queue options from node_form() and node_save() to the modules _nodeapi hooks. --- modules/comment.module | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'modules/comment.module') diff --git a/modules/comment.module b/modules/comment.module index effac37d1..e9fde950c 100644 --- a/modules/comment.module +++ b/modules/comment.module @@ -1490,4 +1490,16 @@ function comment_update_index() { return array("last_update" => "comment_cron_last", "node_type" => "comment", "select" => "SELECT c.cid as lno, c.subject as text1, c.comment as text2 FROM comments c WHERE c.status = 0 AND timestamp > ". variable_get("comment_cron_last", 1)); } -?> +function comment_nodeapi(&$node, $op, $arg = 0) { + switch ($op) { + case "form": + if ($arg == "admin" && user_access("administer comments")) { + return form_select(t("Allow user comments"), "comment", $node->comment, array(t("Disabled"), t("Read only"), t("Read-write"))); + } + break; + case "fields": + return array("comment"); + } +} + +?> \ No newline at end of file -- cgit v1.2.3