![]() |
Hi Dark!
Maybe this is better, just add this to credits_daily.php ? $twoyearsago = time() - 63072000; $vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "user SET credits = 0 WHERE lastactivity < $twoyearsago"); and also, this: $vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "user SET credits_canearn = 0 WHERE lastactivity < $twoyearsago"); So, the first query zeros out all the old credits of users inactive for more than two years, the second query turns off all credit earnings for the same group. However, I need to turn credits_canearn back on when a user become active again, something like: $vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "user SET credits_canearn = 1 WHERE lastactivity > $twoyearsago"); Thoughts? |
Update; I ended up with a simple vB cron file that does this once a day:
Quote:
|
to simplify, you could add just this one query to the bottom of credits_daily
PHP Code:
|
Great idea, thanks!
Quote:
But I don't understand it, ROTFL :D |
:p well its a combination of a couple sql tricks. the first sets the canearn flag to 1 or 0 (true or false, but it gets typecasted to int because thats the column type) based on the activity date.
the second multiplies your credits against that flag... if you can earn credits, then its 1 * your credits = your credits stay the same. if you cant earn credits, then its 0 = your credits are now 0. |
Oh, so the () around the lastactivity condition makes it boolean?
Wow! I would call you Master, and me Grasshopper, but I don't want to end up in the closet of a hotel room in Bangkok with ropes "everywhere" :D |
in response to the... first part
the > makes it boolean, but the column (credits_canearn) is int, so boolean true becomes int 1 and boolean false becomes int 0. the parens are just for clarification |
Quote:
|
is this support point per forum?
i need a points system that support Point Per forum to set point per forums |
yep, it has forum overrides
|
All times are GMT. The time now is 05:47 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|