Firefox PHP

Module: Self-Delete Posts Option

Posted by Joe Curia 
All files from this thread

File Name File Size   Posted by Date  
self_delete_posts_v5_2_1_01.zip 14.9 KB open | download Joe Curia 04/06/2010 Read message
Module: Self-Delete Posts Option
March 12, 2010 10:14PM
This module allows authors to "delete" their own posts, which are then hidden until a moderator fully deletes them or (if enabled) a cronjob fully deletes them after a set number of days.

By default, only thread-starting posts without any replies can be deleted. The admin can allow replies and posts with replies to be deleted from the module's settings page.

Template Customization:
In order to display the "Delete" link you must make the following template edit to your template's read.tpl, read_thread.tpl, and read_hybrid.tpl files. Wherever you want the link to appear, add these lines:
{IF MODERATOR false}
    {IF MESSAGES->URL->SELF_DELETE_POST}
        {MESSAGES->URL->SELF_DELETE_POST}
    {/IF}
{/IF}

Using a Cronjob to Fully Delete Posts:
If you would like to use a cronjob to fully delete posts a set number of days after they have been deleted you will need to complete two steps:

First, you must add a cronjob to call the Phorum "scheduled" hook from the Phorum script.php file. I would recommend that this cronjob run every hour. The module will handle any time-outs or errors which otherwise could cause the cronjob to run two instances of this module. This is one example cronjob:
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.

Second, you must enable the cronjob option from this module's settings page and then choose the number of days to wait after an author deletes their own post before fully deleting the post.

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




Edited 1 time(s). Last edit at 03/13/2010 10:48PM by Joe Curia.
Attachments:
open | download - self_delete_posts_v5_2_1_01.zip (14.9 KB)
Re: Module: Self-Delete Post Option for Thread-Starting Authors
March 13, 2010 07:38AM
Does this mean that a user can delete his reply to another persons topic, or that he can delete his topic that he started only?

For example...

Topic
..... Reply #1
..........Reply#2
.....Reply#3
.....Reply#4
..........Reply#5


Can the person who posted Reply #2,3, & 5 delete their posts before someone replies to it?


Robert Angle
Phorum lover, nothing more.
Ruminations
Re: Module: Self-Delete Post Option for Thread-Starting Authors
March 13, 2010 08:17AM
Nope, at least not right now. Only the thread-starting author can delete the thread. If that is still confusing, replace "thread" with "topic" and that might help. If allowing an author to delete his reply to another post is something you would want, I will need to build that option into the module. If so, it would follow the same rules as a thread-starter. If the admin allows deleting a post to which others have replied, then even the authors of Replies #1 and #4 in your example would be allowed to delete their posts.


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: Self-Delete Post Option for Thread-Starting Authors
March 13, 2010 08:32AM
Quote
Joe Curia
If allowing an author to delete his reply to another post is something you would want, I will need to build that option into the module.

I think that would be useful. A topic/thread starter usually has premeditated the things he has decided to put up for discussion, but a reply can be posted without much thought. I have had users post an emotionally charged reply and then send me a PM begging for me to delete it before the other poster comes to the board and sees it.

So the option to self-delete a reply before others have replied to their reply would be nice!

Quote

If so, it would follow the same rules as a thread-starter. If the admin allows deleting a post to which others have replied, then even the authors of Replies #1 and #4 in your example would be allowed to delete their posts.

Does this mean that if he deletes his post, the replies get deleted too? Or just his post? I do not plan on enabling this if a user can delete a whole string of replies just because he was the topic starter.


Robert Angle
Phorum lover, nothing more.
Ruminations
Re: Module: Self-Delete Post Option for Thread-Starting Authors
March 13, 2010 09:06AM
I believe in giving admins all the power, so yes I will build in your feature request, and yes, if the admin chooses to allow post authors to delete their own messages to which replies have been made, those replies will also be deleted, but only if the admin allows it. By default, only posts without replies can be deleted.


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
Module: Self-Delete Posts Option v5.2.1.01 - Option to allow users to delete their own replies
March 13, 2010 10:50PM
I have completed v5.2.1.01 of this module with the following change:

- Enhancement: Added the option for users to delete their own replies to other messages. Thanks go to Phorum user Robert Angle for pointing out the need for this feature.


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: Self-Delete Posts Option
October 11, 2010 12:39PM
Hi,
we use template lightweight and threadview + mod treeview. Phorum 5.2.15a
in which file I am doing the code:
Language: PHP
{IF MODERATOR false} {IF MESSAGES->URL->SELF_DELETE_POST} {MESSAGES->URL->SELF_DELETE_POST} {/IF} {/IF}
I do it in the file: read.tpl, read_thread.tpl, and read_hybrid.tpl from template /phorum/templates/lightweight/ but the delete button does not appear. in the admin-panel => Modules =>Self-Delete Posts Option is only set "Allow Authors to self-delete their own replies"
the Module is check "on".

what am I doing wrong?

thanx masei1202
Re: Module: Self-Delete Posts Option
October 11, 2010 12:44PM
The treeview mod provides its own set of templates for the read page, so you will have to edit the template files within that module's directory (mods/treeview/templates/emerald/*).

Also note that directly editing an existing template is a bad idea, because you might accidentally overwrite existing template files on upgrade. It's better to copy an existing template like lightweight to a new directory and update the info.php in the new directory to give your template a different name. Then select that new template in the forum settings instead of lightweight.

See also the installation docs on this site and those in the distribution (docs/creating_templates.txt).


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce



Edited 1 time(s). Last edit at 10/11/2010 12:46PM by Maurice Makaay.
Re: Module: Self-Delete Posts Option
October 11, 2010 02:44PM
Quote
The treeview mod provides its own set of templates for the read page, so you will have to edit the template files within that module's directory (mods/treeview/templates/emerald/*).
This has no effect. I've edited both files in that folder in turn.
Too bad. I want to use this tool.

thanx
masei1202
Re: Module: Self-Delete Posts Option
October 11, 2010 02:52PM
Well, start out with editing something unconditional. So just add "WAAAAH!!!" or something to the template that you think that you are viewing. If you are editing the correct template, then the "WAAAAH!!!" will show up in the browser. If you edit the wrong template, it will not.

Also beware that you use the correct message variables. Within the read_threads.tpl file, you must use MESSAGE instead of MESSAGES, because you are viewing a single message there, not an array of messages.


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

Click here to login