summaryrefslogtreecommitdiff
path: root/doc/plugins/write.mdwn
diff options
context:
space:
mode:
authorJoey Hess <joey@gnu.kitenet.net>2009-01-16 20:46:55 -0500
committerJoey Hess <joey@gnu.kitenet.net>2009-01-16 20:46:55 -0500
commitf7b2cfcf50f12ad6ce7358f74e8db9d6083aa284 (patch)
treedd2ab8747231a8de6c3e08a143247175611cdf8a /doc/plugins/write.mdwn
parent362a3295563a11ae93370d365d9b0369d0726199 (diff)
checkcontent: New hook, can be used to implement arbitrary content filters, including spam filters.
Diffstat (limited to 'doc/plugins/write.mdwn')
-rw-r--r--doc/plugins/write.mdwn22
1 files changed, 21 insertions, 1 deletions
diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn
index 405876d58..99eea3d16 100644
--- a/doc/plugins/write.mdwn
+++ b/doc/plugins/write.mdwn
@@ -303,7 +303,7 @@ can check if the session object has a "name" parameter set.
### canedit
- hook(type => "canedit", id => "foo", call => \&pagelocked);
+ hook(type => "canedit", id => "foo", call => \&canedit);
This hook can be used to implement arbitrary access methods to control when
a page can be edited using the web interface (commits from revision control
@@ -321,6 +321,26 @@ This hook should avoid directly redirecting the user to a signin page,
since it's sometimes used to test to see which pages in a set of pages a
user can edit.
+### checkcontent
+
+ hook(type => "checkcontent", id => "foo", call => \&checkcontent);
+
+This hook is called to check the content a user has entered on a page,
+before it is saved, and decide if it should be allowed.
+
+It is passed named parameters: `content`, `page`, `cgi`, and `session`. If
+the content the user has entered is a comment, it may also be passed some
+additional parameters: `author`, `url`, and `subject`. The `subject`
+parameter may also be filled with the user's comment about the change.
+
+Note: When the user edits an existing wiki page, the passed `content` will
+include only the lines that they added to the page, or modified.
+
+The hook should return `undef` on success. If the content is disallowed, it
+should return a message stating what the problem is, or a function
+that can be run to perform whatever action is necessary to allow the user
+to post the content.
+
### editcontent
hook(type => "editcontent", id => "foo", call => \&editcontent);