PDA

View Full Version : auto-kick from group after X day without activity ?


Essamz
05-27-2005, 01:31 AM
hi ,,
is there a hack that remove the user from certain usergroup ? :ermm:

i have VIP usergroup ,, and i cant keep my eye on them every day and see if they are active or not ..
so it would be great idea to make this hack ,, :)

Andreas
05-27-2005, 02:27 AM
primary or secondary?

Essamz
05-27-2005, 02:44 AM
<u>primary </u>

remove them from usergroupid = 677

to Registered "usergroupid = 2"

Andreas
05-27-2005, 02:51 AM
That is easy

<?php
error_reporting(E_ALL & ~E_NOTICE);

if (!is_object($DB_site))
{
exit;
}

$DB_site->query("UPDATE " . TABLE_PREFIX . "user SET usergroupid = 2 WHERE usergroupid = 677 AND lastactivity < " . (TIMENOW-X*86400));

log_cron_action('Inactive VIP Users reset to Registered', $nextitem);
?>

Replace X with the number of days, save this a a php-file in includes/cron, create a cron-job for it (to be run once/day for example) and you're done.

Essamz
05-27-2005, 03:01 AM
thank you very much :)

Paul M
05-27-2005, 03:11 AM
primary

remove them from usergroupid = 677

to Registered "usergroupid = 2"Usergroup 677 !!! Jesus .....

Andreas
05-27-2005, 08:55 AM
Well, if you are experimenting a lot ... creating and deleting usergroups :D

The Ottoman
07-07-2006, 01:17 PM
That is easy

<?php
error_reporting(E_ALL & ~E_NOTICE);

if (!is_object($DB_site))
{
exit;
}

$DB_site->query("UPDATE " . TABLE_PREFIX . "user SET usergroupid = 2 WHERE usergroupid = 677 AND lastactivity < " . (TIMENOW-X*86400));

log_cron_action('Inactive VIP Users reset to Registered', $nextitem);
?>

Replace X with the number of days, save this a a php-file in includes/cron, create a cron-job for it (to be run once/day for example) and you're done.


If I wanted to run this against multiple usergroups (say group 123, 5 and 6), would I be correct in adjusting the syntax of the code to something along the lines of :

user SET usergroupid = 2 WHERE usergroupid = 677 OR 123 OR 5 OR 6 AND lastactivity....

rogersnm
07-07-2006, 03:58 PM
Yes that would work fine :)

The Ottoman
07-11-2006, 01:38 AM
So I've saved this code:
<?php
error_reporting(E_ALL & ~E_NOTICE);

if (!is_object($DB_site))
{
exit;
}

$DB_site->query("UPDATE " . TABLE_PREFIX . "user SET usergroupid = 2 WHERE usergroupid = 15 AND lastpost < " .

(TIMENOW-45*86400));

log_cron_action('Inactive VIP Users reset to Registered', $nextitem);
?>

to a file called autokick.php, created a cron job, set it to log, and ran it manually, I just get a screen with the cron job name, and it just hangs.


I'm a tard, what am I doing wrong?

rogersnm
07-24-2006, 02:22 PM
read the pm ;)

brvheart
07-24-2006, 05:08 PM
I am interested in this as well, would be a great add on to Mod Statistics ;)

rogersnm
07-25-2006, 06:03 AM
he got it working :)

ramar
01-10-2007, 04:23 PM
same problem here, just the screen with the crono job name and nothing happen!