PDA

View Full Version : exclude usergroups from automatic user pruning


waza
06-26-2005, 10:00 PM
Hey,
this is my first (small) addon i made and probably it could be better, but it works...

What does this do?
This is actually an addon for the atomatic user pruning hack you can find here (https://vborg.vbsupport.ru/showthread.php?t=78952)
with this hack you can exclude several usergroups from been pruned.

How to Install

Open your deleteinactive.php file

FIND

// This only needs to be modified if you set above to false
$groupid=8;


BELOW ADD

//set this to false if you want to exclude some usergroups from pruning
$pruneall = false;

// If you have set false above, you can set here the usergroups you do NOT wish to be modified, seperate each groupid with a space
$exclude = "1 8 3";



FIND

$prunedmembers = $DB_site->query("
SELECT * FROM `" . TABLE_PREFIX . "user`
WHERE `posts` <= '$maxposts'
AND `lastactivity` <= '" . (TIMENOW - ($lastactivity * 86400)) . "'
AND `lastpost` <= '" . (TIMENOW - ($lastpost * 86400)) . "'
");


REPLACE WITH

if($pruneall==true){
$prunedmembers = $DB_site->query("
SELECT * FROM `" . TABLE_PREFIX . "user`
WHERE `posts` <= '$maxposts'
AND `lastactivity` <= '" . (TIMENOW - ($lastactivity * 86400)) . "'
AND `lastpost` <= '" . (TIMENOW - ($lastpost * 86400)) . "'
");
}else{
$donotprune = explode(" ", $exclude);
for($i=0; $i<count($donotprune); $i++){
$endquery.="AND `usergroupid` != '".$donotprune[$i]."' ";
}
$prunedmembers = $DB_site->query("
SELECT * FROM `" . TABLE_PREFIX . "user`
WHERE `posts` <= '$maxposts'
AND `lastactivity` <= '" . (TIMENOW - ($lastactivity * 86400)) . "'
AND `lastpost` <= '" . (TIMENOW - ($lastpost * 86400)) . "' $endquery
");
}



grz,
seba

Marco van Herwaarden
06-27-2005, 08:50 AM
Thanks for sharing your work.

Could you please also provide the instructions in a (zipped) textfile. This makes it easier for future refence (upgrades for example) for those who installed it.

waza
06-27-2005, 09:00 AM
K, I added a txt file with the instructions.