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?



Error (none / 0) (#2)
by Neon383 on Tue Aug 20, 2019 at 12:20:05 AM PST

I also facing an error while using this code box I don't know where I am doing mistake. The www.resumewriterslist.com/careeraddict-com-review also share a video in which they explain about it's working and run it as well.



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

Scoop Site Scroller: Get one yourself!
Scoop
The swiss army chainsaw of Content Managment.

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