Scoop -- the swiss army chainsaw of content management
Front Page · Everything · News · Code · Help! · Wishlist · Project · Scoop Sites · Dev Notes · Latest CVS changes · Development Activities
Scoop Box Exchange - Show Box: erase_user 1.00

Author: janra [Info]

Description:

erases all of a user's comments, ratings, stories, etc, and anonymizes the account. Intended for spammers. Put this box on the user info page.

Box Code:

return unless $S->have_perm('edit_user');

my $uid = $S->cgi->param('uid');
my $nick = $S->cgi->param('nick');
unless ($uid) {
$uid = $S->get_uid_from_nick($nick);
}
my $erase = $S->cgi->param('erase');
my $confirm = $S->cgi->param('confirm');

#warn "Nick is: $nick, uid is $uid\n";
return unless ($uid);

my $return;

if ($erase && $confirm && $uid) {
$return = "Erasing $nick...<br>";

# First, wipe user ratings
$S->undo_user_ratings($uid);
$return .= 'Wiped ratings...<br>';

# Make anonymous
my ($rv, $sth) = $S->db_update({
WHAT => "users",
SET => qq{perm_group = "Anonymous"},
WHERE => "uid = $uid"});
$sth->finish();
$return .= 'Anonymized account...<br>';

# Remove all comments
($rv, $sth) = $S->db_select({
WHAT => 'sid, cid, pid',
FROM => 'comments',
WHERE => "uid = $uid"});
my $i = 0;
my ($sid, $cid, $pid) = $sth->fetchrow();
while ($cid) {
$i++;
$S->_delete_comment($sid, $cid, $pid);
($sid, $cid, $pid) = $sth->fetchrow();
}
$sth->finish();
$return .= "Erased $i comments...<br>";

# Hide stories
($rv, $sth) = $S->db_update({
WHAT => 'stories',
SET => "displaystatus = '-1'",
WHERE => "aid = $uid"
});
$return .= "Hid all stories...<br>";
$return .= "Done.";
} else {
#my $urlnick = $S->urlify($nick);
$return = qq{
<form name="eraseuser" method="GET" action="|rootdir|/erase">|norm_font|
<input type="hidden" name="nick" value="$nick">
<input type="submit" name="erase" value="Erase $nick">
<input type="checkbox" name="confirm"> Are you sure?
|norm_font_end|</form>};
}

return $return;
Display: Sort:
Question about the /erase command (none / 0) (#1)
by dnaworks on Wed Feb 28, 2007 at 06:33:21 PM PST

Hi there - I get a 404 error trying to use this box; have I missed something to enable the /erase command?



Menu
· create account
· faq
· search
· report bugs
· Scoop Administrators Guide
· Scoop Box Exchange

Scoop Site Scroller: Get one yourself!
Scoop::Ads
Almost there...

Login
Make a new account
Username:
Password:

Hosted by ScoopHost.com Powered by Scoop
All trademarks and copyrights on this page are owned by their respective companies. Comments are owned by the Poster. The Rest © 1999 The Management

create account | faq | search