View Full Version : Auto Delete users in group after 45 days
hurrican
07-26-2004, 11:30 PM
I am looking to delete my users who sit in the "Awaiting E-Mail Confirmation" Group for more than 30-45 days. I found a cron job that will delete inactive users, but i'm not quite smart enough to figure out how to make it delete users only in a certain usergroup if in that group for 45 days.. Would this be the script that I'd need to run?? Any help would be GREATLY Appreciated by you SQL gurus :)
<?
//Delete non-activated members after 45 days
require ("./global.php");
$DB_site->query ("DELETE FROM user WHERE joindate > '".(time() - 3888000)."' AND usergroup=2");
?>
Andreas
07-26-2004, 11:37 PM
AFAIK there is no timestamp when a users becomes member of a usergroup, so this might be tricky ...
hurrican
07-27-2004, 12:20 AM
Thanks Kirby,
Duh to me :) lol.. I had forgotten about that.. How about something like this?
If a user registered 45 days ago, and is still awaiting email confirmation, and has 0 posts, the 46th day, their account will be deleted. This should solve the problem of having accidentally deleted 'normal' users who might have merely changed their e-mail address where we can manually find out what their problem is. This would cause only those new members (who I don't allow to post while awaiting confirmation) with 0 posts to be eliminated from my database.
Is a query like this possible?
I'm also interested to see this cron job. I have more than 100 users waiting for confirmation and it puts additional load on the server to send 100 e-mails just to remind them to activate their account.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.