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