2 package IkiWiki::Plugin::moderatedcomments;
9 hook(type => "getsetup", id => "moderatedcomments", call => \&getsetup);
10 hook(type => "checkcontent", id => "moderatedcomments", call => \&checkcontent);
22 description => 'Moderate comments of logged-in users?',
28 sub checkcontent (@) {
31 # only handle comments
32 return undef unless pagespec_match($params{page}, "postcomment(*)",
33 location => $params{page});
35 # admins and maybe users can comment w/o moderation
36 my $session=$params{session};
37 my $user=$session->param("name") if $session;
38 return undef if defined $user && (IkiWiki::is_admin($user) ||
39 (exists $config{moderate_users} && ! $config{moderate_users}));
41 return gettext("comment needs moderation");