Firefox PHP

Module: Automatic Message Pruning

Posted by Joe Curia 
All files from this thread

File Name File Size   Posted by Date  
automatic_message_pruning_v5_2_1_00.zip 10.5 KB open | download Joe Curia 11/08/2010 Read message
automatic_message_pruning_scheduled.php 14.8 KB open | download Joe Curia 11/29/2010 Read message
p1.jpg 47.6 KB open | download CBiLL 11/29/2010 Read message
p2.jpg 45.7 KB open | download CBiLL 11/29/2010 Read message
p3.jpg 50.7 KB open | download CBiLL 11/29/2010 Read message
settings.php 10.5 KB open | download Joe Curia 11/29/2010 Read message
willkommen2.jpg 11.2 KB open | download gelbeseiten 11/14/2013 Read message
Module: Automatic Message Pruning
November 08, 2010 08:27AM
This module allows an admin to automatically close, hide, or delete posts in selected forums after a selected period of time. Each forum can be configured individually. Sticky posts can be excluded.

Settings:
On the settings page for this module you can set each forum to have its own custom actions on selected messages. You can choose to close, hide, or delete posts based on the age of either the starting topic or the last post in the topic. You can set any number of hours, days, or months (30 days) after which to process the posts.

You must use a cron job to process posts with this module. You have two options to do this. If your host supports cron jobs on your server, you can set your own cron job using the "scheduled" hook. If your host does not support cron jobs, you can use a third party service, such as www.setcronjob.com or www.cronless.com. I don't endorse any particular service and others can be found on Google with a search for "free cron jobs."

In either case, I would advise running the cron job once per hour. If your site receives more than 1000 posts per hour and you are having posts automatically deleted then the cron job should be run more often.

Setting up a Cron Job on Your Server:
Your hosted cron job should call the Phorum "scheduled" hook from the Phorum script.php file. The module will handle any time-outs or errors which otherwise could cause the cron job to run two instances of this module. This is one example cron job:

0 * * * * cd your/phorum/root && /usr/bin/php ./script.php --scheduled

There should be no output from this script unless there is an error. If possible I would also advise that you have the output from this script either logged or emailed.

Setting up a Cron Job Through a Third Party Service:
Each third party service will have its own setup instructions but all of them should ask for a url which will be opened on a regular schedule. The url to use for this module is provided at the top of the settings page. Simply highlight and copy the entire url in the text box. This url includes a unique certificate for your site, generated the first time you open the settings page.

Todo:
- Add features as they are requested.


Joe Curia (aka Azumandias)
Modules: l0Admin Mass Email00000000l000000Automatic Time Zones000ll.l00000Enhanced Custom Profiles0.00Google Calendar0000l.l000000Post Previews
000000000Admin Security Suite000000000000Check Modules for Upgrades0000External Authentication000000Group Auto-Email00000.00000Private Message Alerts
000000000Attachment Download Counter0000Custom Attachment Icons000ll.ll00Favorite Forums000000.00000Highlighted Search Terms0000Self-Delete Posts Option
000000000Attachment Watermarks0l00000000Custom Language Database00l.l.0Forum Lockdown00000.00000Ignore Forums0000000000000Threaded Tree View
000000000Automatic Message Pruning00.llll.00Easy Color Scheme Manager0l.l00Forum Subscriptions0000lll000Moderated User Group
Templates:lGeneric Integration000000000 0000Simple Rounded000000 00000000Tabbed Emerald
Attachments:
open | download - automatic_message_pruning_v5_2_1_00.zip (10.5 KB)
Re: Module: Automatic Message Pruning
November 08, 2010 12:55PM
Installed and running. This one really eases keeping forums tidy for lazy admins like me.

Thanks again Joe. :)
Re: Module: Automatic Message Pruning
November 09, 2010 11:04AM
a nice extra would be the option to "unsticky" sticky notes after a time.
Re: Module: Automatic Message Pruning
November 09, 2010 12:09PM
What would be the use case for that? (just interested about it) It sounds rather contra-conceptual to me. To me, stickies are always manually managed, so I'm interested to know how you use the stickies.

When module functionality would have to be written, then I think it would be more appropriate as a separate module, than to add it to this message pruning module. The functionalities do not really match IMO. But maybe your use case makes it logical to do so.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Module: Automatic Message Pruning
November 09, 2010 01:26PM
maurice,

the main reason is lazyness :)
"my" moderators use stickies for messages that should stay on top for a limited time, think of them as some kind of reminder. those messages should not be deleted, but "vanish" in the normal posts after a given time. unfortunately, they use it very often and they tend to forget to un-sticky them. so it would be nice to to make them unsticky automatically.
Re: Module: Automatic Message Pruning
November 09, 2010 01:30PM
A combination of laziness and semi-stickiness, got it, thanks ;-)


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Module: Automatic Message Pruning
November 09, 2010 03:27PM
I guess I would agree with Maurice that this should be a separate module. Ideally it would create a third "Temporary Sticky" sort option on the posting form. The admin would then determine how long these types of messages should remain sticky. After that time, the message would be set to normal through a cron job. Unfortunately I am back to the weekly grind and it is a busy week on top of that. I may try hand at this sometime soon, but no promises.


Joe Curia (aka Azumandias)
Modules: l0Admin Mass Email00000000l000000Automatic Time Zones000ll.l00000Enhanced Custom Profiles0.00Google Calendar0000l.l000000Post Previews
000000000Admin Security Suite000000000000Check Modules for Upgrades0000External Authentication000000Group Auto-Email00000.00000Private Message Alerts
000000000Attachment Download Counter0000Custom Attachment Icons000ll.ll00Favorite Forums000000.00000Highlighted Search Terms0000Self-Delete Posts Option
000000000Attachment Watermarks0l00000000Custom Language Database00l.l.0Forum Lockdown00000.00000Ignore Forums0000000000000Threaded Tree View
000000000Automatic Message Pruning00.llll.00Easy Color Scheme Manager0l.l00Forum Subscriptions0000lll000Moderated User Group
Templates:lGeneric Integration000000000 0000Simple Rounded000000 00000000Tabbed Emerald
Re: Module: Automatic Message Pruning
November 28, 2010 07:40AM
I been wanting a module like this to delete messages in some of my forums that are older than 6 months.

So I downloaded this module and follow instruction but for some strange reason I couldn't save one of the forum settings and it would error out when I run the script. When I click Save to save my module settings one of the last forum setting would just get wiped out and go back to default blank setting.

Here the error message I get when excuting the line

<br /><b>Fatal error</b>: Call to undefined function phorum_api_file_delete() in

<b>/home/garyk/public_html/mods/automatic_message_pruning/automatic_message_pruning_scheduled.php</b> on line <b>274</b><br />gar



Bill
Re: Module: Automatic Message Pruning
November 28, 2010 10:38PM
I wonder if this issue is because I am using Store file on disk module?

All of our post attachment are storage on disk instead of in DB, we would like to see those attachement deleted along with the posts. it like over 100,000 photos in there is the main reason why we would need this module.


Bill
Re: Module: Automatic Message Pruning
November 28, 2010 11:20PM
It is not related to storing the attachments on disk. The error tells that the file API function is not known. Most likely, the file API layer is not loaded, prior to the offending call.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Sorry, only registered users may post in this forum.

Click here to login