]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/comments.pm
comments: Avoid showing comment moderation button in prefs to non-admins.
[ikiwiki.git] / IkiWiki / Plugin / comments.pm
index 995d1f4eb6a1252db56914bc6083af07edd390b8..ee53dbc91e4e0b6768e36d23705da64a02cf0e1b 100644 (file)
@@ -26,6 +26,8 @@ sub import {
        hook(type => "htmlize", id => "_comment", call => \&htmlize);
        hook(type => "pagetemplate", id => "comments", call => \&pagetemplate);
        hook(type => "formbuilder_setup", id => "comments", call => \&formbuilder_setup);
+       # Load goto to fix up user page links for logged-in commenters
+       IkiWiki::loadplugin("goto");
        IkiWiki::loadplugin("inline");
 }
 
@@ -603,7 +605,8 @@ sub formbuilder_setup (@) {
        my %params=@_;
 
        my $form=$params{form};
-       if ($form->title eq "preferences") {
+       if ($form->title eq "preferences" &&
+           IkiWiki::is_admin($params{session}->param("name"))) {
                push @{$params{buttons}}, "Comment Moderation";
                if ($form->submitted && $form->submitted eq "Comment Moderation") {
                        commentmoderation($params{cgi}, $params{session});