]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/comments.pm
add a button to prefs page for comment moderation
[ikiwiki.git] / IkiWiki / Plugin / comments.pm
index ad5395a8248d6600e67015030d7afb741f5ead16..c95f77a42e5d4a212bc88e474687d0c1f8795d47 100644 (file)
@@ -26,6 +26,7 @@ sub import {
        hook(type => "htmlize", id => "_comment", call => \&htmlize);
        hook(type => "pagetemplate", id => "comments", call => \&pagetemplate);
        hook(type => "cgi", id => "comments", call => \&linkcgi);
+       hook(type => "formbuilder_setup", id => "comments", call => \&formbuilder_setup);
        IkiWiki::loadplugin("inline");
 }
 
@@ -618,6 +619,18 @@ sub commentmoderation ($$) {
        exit;
 }
 
+sub formbuilder_setup (@) {
+       my %params=@_;
+
+       my $form=$params{form};
+       if ($form->title eq "preferences") {
+               push @{$params{buttons}}, "Comment Moderation";
+               if ($form->submitted && $form->submitted eq "Comment Moderation") {
+                       commentmoderation($params{cgi}, $params{session});
+               }
+       }
+}
+
 sub comments_pending () {
        my $dir="$config{wikistatedir}/comments_pending/";
        return unless -d $dir;