![]() |
HowTo? Move / Delete Threads of one forum after x days
Hello,
i'd like to do two jobs automatically: 1.) "Delete all threads in forum id=88 after 365 days" 2.) "Move all threads older than 100 days and the thread-prefix=done from forum-id=10 to forum-id=12" Can anyone show me a cronjob for this? kr Chris |
Create a plugin hooked at "cron_script_cleanup_daily" with the code:
PHP Code:
Note: I have not tested this code. Please test this first on your test installation, and then make a backup of your database before running this code the first time on your live site. I cannot emphasize enough how important this is! As the code is written, the thread deletion is soft-delete. To use a hard-delete, change the line: PHP Code:
PHP Code:
|
Hy,
thank you for the code! I'll try it on my testboard and will give you feedback. One question: If i "hard-delete" the threads, than i won't need the line for the attachments? PHP Code:
|
Yeah, I'm not sure but I would just leave the array as is because it won't hurt for it to be there. :)
|
ok, i will give it a try
|
Quote:
|
I was on tour this weekend.
The code is running in my testboard since this afternoon. Tomorrow i give you my feedback. kr Chris |
1 Attachment(s)
Hello,
today i found time to test the plugin. I don't know what's wrong, but it won't work! When the plugin is active, the cronjob (id 15 - daily clean up) didn't end correct. Attachment 156708 Is the plugin inactive, evrything is fine with the cornjob: Attachment 156709 This is the code i use fpr my testboard: - forum-id = 4 => delete threads after 365 days - forum-id = 10 => move threads with the prefix "Delete" after 100 days to forum-id = 12 - my User-ID = 1 - my Username = Chris PHP Code:
|
I don't read German, so the screenshots aren't of much use to me. Sorry :(
You don't want to edit the 'userid' and 'username' keys of the $delinfo array...that could be the cause of the issue. |
Quote:
Quote:
|
I will run the code on my local dev site to see what I find. :)
--------------- Added [DATE]1509428993[/DATE] at [TIME]1509428993[/TIME] --------------- Okay, this should work: PHP Code:
I move that these double-post merges go away. :) |
Thanks for your help and spending time on my problem,
but the code from the post above won't work in my board :( I used it, as you posted it, or have i to do some changes? kr Chris |
It should work exactly as I posted it, but it could be that you have other plugins hooked at "threaddata_delete" that are causing an issue. Do you have any plugins hooked there?
|
Quote:
|
When you manually run the daily cleanup, what error(s) do you get?
|
1 Attachment(s)
Hy,
sorry for the late answer, but i wasn't at home till now. All the shedulded tasks even don't run! Attachment 156714 The plugin is disabled, and the task for "daily cleanup" run: Attachment 156715 but when i open the logfile, there is no entry for the task! Attachment 156716 I don't know whats wrong |
When you manually run the daily cleanup, what error messages do you get?
|
this is the error message:
PHP Code:
|
All times are GMT. The time now is 03:28 AM. |
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:
|