The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Remove old thread subscriptions
is there a query or something that could remove all thread subscriptions of users who haven't been on the forum for xxx amount of time?
|
#2
|
|||
|
|||
Well, I strongly suggest that you have a backup before you try this, because I haven't tested it extensively. But first try this:
Code:
SELECT username, FROM_UNIXTIME(lastactivity) FROM user WHERE lastactivity < (UNIX_TIMESTAMP() - (86400 * X)) where you replace the red X with the number of days of inactivity. If this seems to select the right users, then you can do this: Code:
DELETE FROM subscribethread WHERE userid IN ( SELECT userid FROM user WHERE lastactivity < (UNIX_TIMESTAMP() - (86400 * X)) ) |
#3
|
||||
|
||||
It "seems" to have worked.
186599 rows deleted. (Query took 14.3054 sec) My subscriptions are still there... So I "think" it worked. Thank you... --------------- Added [DATE]1419328510[/DATE] at [TIME]1419328510[/TIME] --------------- Is there a way to make this into a cron job so it can run automatically?? |
#4
|
|||
|
|||
Quote:
Code:
$vbulletin->db->query_write("DELETE FROM " . TABLE_PREFIX . "subscribethread WHERE userid IN ( SELECT userid FROM " . TABLE_PREFIX . "user WHERE lastactivity < (UNIX_TIMESTAMP() - (86400 * X)) )"); |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|