A few weeks ago, dmd asked me if I could create a Perl script to allow him to examine fled users' lowest-rep writeups and then kill them. The end result was eem.cgi (you can look at it at http://3e.org/e2/eem.cgi?source ). But the Higher Powers would prefer such a thing be on E2, so after some work, I've produced this superdoc, which I suggest be titled emendatoris ex machina.
BTW, this was produced by hacking on Everything User Search until it did what I believe needs to be done. From some discussion, I believe that by virtue of using the displaywriteuptitle and voting stuff, the killing features should be implemented.
Warning: Obviously, I've never tested this thing at all. The code might not work. I might be making an obvious error -- or a subtle one.
[%
unless exists $HTMLVARS{"group_content editors"}{getId($USER)} || exists $HTMLVARS{group_gods}{getId($USER)}) {
$str.='<p><font size=4>You are not the boss of';
$str.=linkNode($$NODE{EDB}, 'user', 'ME');
$str.=', mortal.</font>';
return;
}
%]
[emendatoris ex machina] -- the machinery of the editors -- displays the fifty lowest reputation
writeups a user or list of users have, and allows you to kill them, check the context of the
entire node, and even vote on them.
It is aimed at helping to clear out old [E1] crud by [fled user|fled users]. The "[context]" link
will take you to the full form of the writeup.
[{openform}]
[%
$query->textarea("usersearch", $$NODE{"usersearch"}, 10, 50, "", "");
%]
[{closeform}]
[%
my $str;
my $results=0;
my @userpile = split(/\r?\n+/, $query->param('usersearch'));
my $orderby = "reputation ASC";
$str.=htmlcode('votehead');
foreach my $us (@userpile) {
my $count = 0;
my $user = getNode($us,'user');
my $rep = (($$user{node_id} == $$USER{node_id}) || isGod($USER));
return "It seems that the user \"$us\" doesn't exist... how very, very strange..." unless(defined $user);
my $nodes = selectNodeWhere({author_user=>getId($user),
type_nodetype =>
getId(getType('writeup'))}, 'title', $orderby)
if (getId($user));
return linkNode($user)." has no writeups." unless($nodes);
my $max = ($count+50<@$nodes)? $count+50:@$nodes;
for(my $c = $count; $c<$max; $c++) {
my $n = $DB->sqlSelectHashref("*", "node, writeup", "node_id=$$nodes[$c] and writeup_id=node_id");
if ($results==0) {
$str .= "<h2>Report for " .
linkNode ($user, $query->param('usersearch')) .
"</h2>";
}
$str .= "<HR>\n";
$str .= '<TABLE border=0 border=0 cellpadding=0 cellspacing=0 width=100%>' . "\n";
$results++;
$str .= "<tr><td>\n<strong>";
$str .= $$n{title};
$str .= "</strong>\n";
$str .= "<table cellpadding=0 cellspacing=0 border=0 width=100%>\n";
$str .= "<td align=left>";
$str .= linkNode{$$n{parent_e2node}, 'context', {lastnode_id => 0});
$str .= "</td>\n";
$str.=htmlcode('displaywriteuptitle',"$$n, timestamp");
$str.="</td><tr><td>";
$str .=
htmlcode('displaywriteuptext', "$$n")
."<br>";
$str.= "</table>\n";
}
}
$str.=htmlcode('votefoot');
$str;
%]