Soft Delete
Author Message
Warning: this plugin has some known issues with messing up counters on the latest MyBB due to the complex workarounds it has to go through to get things working, and the fact that MyBB actually gets bug fixes sometimes.  This can lead to some quirky effects on your board, but usually can be resolved by recounting everything (but you have to do this every so often)

I spent quite a few days working on this plugin - it's quite fiddly to get right and I found it a bit of a challenge to implement (especially the counters).

Basically this stops threads and posts from being "fully" deleted.  Deleted threads/posts are displayed appropriately, only shown to moderators (see screenshots below).  Moderators can then undelete these deleted threads/posts if desired.  Administrators also have the ability to purge (completely remove) deleted threads/posts.

Due to the difficulty of this plugin, I can't be entirely sure that all cases are covered - I have done a fair bit of testing, but if you do find issues, please report them.  To give you an idea of how difficult this plugin was to get right, the development of this plugin actually lead to the finding of a few bugs in MyBB:
http://dev.mybboard.net/issues/827
http://dev.mybboard.net/issues/830
http://dev.mybboard.net/issues/831
http://dev.mybboard.net/issues/860
http://dev.mybboard.net/issues/861
http://dev.mybboard.net/issues/862
http://dev.mybboard.net/issues/863
http://dev.mybboard.net/issues/881

This plugin is somewhat affected by some of these bugs to an extent, though should be nothing major under normal usage.


This plugin requires a code modification (due to the lack of hooks provided).
For MyBB 1.6, see here
For MyBB 1.4 or 1.6 beta: in inc/class_moderation.php, find (FIRST INSTANCE):

PHP Code:
++$forum_counters[$post['fid']]['num_posts'];

add below:

PHP Code:
if(function_exists('softdeletex_approveposts')) eval(softdeletex_approveposts($post));

If you're a fag and think code edits are homosexual, you can GTFO or make a plugin (that works properly) which doesn't require them - go ahead, I challenge you

Upgrade instructions: If you're upgrading from v1.0 or v1.1 to v1.2x, please see this post

Notes:

  • The undelete function has been implemented as an approve, that is, approving a deleted thread/post will undelete it.
  • Deleting an unapproved item, when restored, will no longer be unapproved.
  • Uninstalling the plugin will remove all deleted threads and posts

Known issues:
  • Custom moderation has not been tested with deleted content and may cause issues.  Probably does work, but it may stuff up some counters.
  • Splitting posts from a thread, causing the first post to become a deleted post will cause the thread to be marked as deleted.  However, the thread count of the forum may not go down by 1 due to this.  This is mostly (indirectly) due to a MyBB bug.  But if this really bothers you, it's possible to fix this issue by doing the following modification to inc/class_moderation.php
    Find:

    PHP Code:
    			$forum_counters[$moveto]['threads'] = $forum_cache[$moveto]['threads'];
    			++$forum_counters[$moveto]['threads'];

    Replace with:

    PHP Code:
    			$forum_counters[$moveto]['threads'] = '+1';

  • Deleting posts containing attachments won't cause the attachment count of the thread to go down.  I don't really think this as much of an issue however, as, with standard MyBB behaviour, unapproving attachments or posts doesn't affect the thread's attachment count.


Changelogs: v1.1, v1.2, v1.21, v1.22, v1.23, v1.24, v1.25

Screenshots:


Attached File(s) Thumbnail(s)
       
(This post was last modified: 05-10-2012 09:04 AM by ZiNgA BuRgA.)
Find all posts by this user
Quote this message in a reply
Download: softdelete-1.25.7z (11.4 KB)
Plugin Version: 1.25
Last Updated: 03-12-2011, 09:24 AM

Downloads: 893
MyBB Compatibility: 1.4.x, 1.6.x
Plugin License: GPLv3
Uploader: ZiNgA BuRgA
ZiNgA BuRgA Online
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #11
RE: Soft Delete
(05-01-2010 04:36 AM)Pirata Nervo Wrote:  I had to stop distributing my Soft Delete Posts/Threads plugin for a bug I was not able to fix.
Not sure if yours has this issue too but I'm going to point out that it might have. The problem is in pagination, pagination counts with (approved posts only) so if delete posts are approved the pagination will be messed up. Not sure if you get what I mean.

Great plugin though Smile
Thanks.

I'm not too sure as you may be doing something different.
In this plugin, approving a deleted post = undelete, so it will properly restore the thread counters and all...

My Blog
05-01-2010 09:17 AM
Find all posts by this user Quote this message in a reply
Pirata Nervo Offline
Member
***
Posts: 235
Joined: Jan 2008
Post: #12
RE: Soft Delete
This is how I did it:
- New field in both, posts and threads tables.
- Delete would soft delete and change the new field to "true".
- Restore would set the field to "false".
- Then posts and threads whose value is "true" are not shown to regular users in forumdisplay.php and showthread.php, only to moderators and administrators.

However, this messes up pagination because if there were 10 soft deleted threads and the setting for threads per page on forum display was set to 11 for example, it would show 1 thread only.

Smile
05-01-2010 09:42 PM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Online
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #13
RE: Soft Delete
Mine is similar, however the "deleted" column is synced with the "visible" column, so a deleted thread automatically gets unapproved, and approving it will automatically undelete the thread/post.  So as long as MyBB does its pagination right, this plugin shouldn't suffer from that...

My Blog
05-02-2010 08:54 AM
Find all posts by this user Quote this message in a reply
Pirata Nervo Offline
Member
***
Posts: 235
Joined: Jan 2008
Post: #14
RE: Soft Delete
(05-02-2010 08:54 AM)ZiNgA BuRgA Wrote:  Mine is similar, however the "deleted" column is synced with the "visible" column, so a deleted thread automatically gets unapproved, and approving it will automatically undelete the thread/post.  So as long as MyBB does its pagination right, this plugin shouldn't suffer from that...

Oh Ok then, just wanted to make sure you didn't miss this one but I should have thought you hadn't, you rarely do lol
05-02-2010 10:10 AM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Online
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #15
RE: Soft Delete
Thanks for the pointer nonetheless Tongue

My Blog
05-02-2010 10:49 AM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Online
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #16
RE: Soft Delete
Updated to v1.2.

Changes:
  • fix issue with thread/forum pagination with deleted posts/threads; note that MyBB is also partly affected by a similar issue: http://dev.mybboard.net/issues/1038
  • fix search template conflict with XThreads
  • some MyBB 1.6 beta compatibility fixes
  • deleted posts are now hidden in the list of posts for delete/merge/split selective posts moderation tools
  • fix some bugs with merging deleted threads
  • fix bug which allowed deleted posts to be merged/split
  • fix bug with splitting posts to make the source thread deleted
  • fix bug with uninstalling the plugin
  • modify copy thread behaviour - now, copying a thread will skip all deleted posts (that is, deleted posts won't be present in the copied thread); previously, they'd be copied, but would be undeleted

Note that these updates require an upgrade script to be run.  If you're upgrading from v1.0 or v1.1, upload the softdelete_upgrade.php to your forum's root, and run the script, afterwards, delete it.

Also note this MyBB bug has been found: http://dev.mybboard.net/issues/1048  I actually wrote a partial fix for this, before realising that this is MyBB's issue (this won't really cause any majory side effects).

My Blog
06-27-2010 12:07 AM
Find all posts by this user Quote this message in a reply
Iamazn Offline
Junior Member
**
Posts: 9
Joined: Jul 2010
Post: #17
RE: Soft Delete
I need help uninstalling Soft Delete. I need to reinstall it because I added a few themes. I get this error when I try and uninstall it.

Fatal error: Call to undefined function softdelete_moderation_do_purge() in /home/vhosts/www.mydomain.com/forum/inc/plugins/softdelete/sd_admin.php on line 186

Great plugin by the way. Biggrin
(This post was last modified: 07-09-2010 08:48 AM by Iamazn.)
07-09-2010 08:48 AM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Online
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #18
RE: Soft Delete
Please use v1.2 of Soft Delete.  v1.1 has that bug.

My Blog
07-09-2010 01:31 PM
Find all posts by this user Quote this message in a reply
Iamazn Offline
Junior Member
**
Posts: 9
Joined: Jul 2010
Post: #19
RE: Soft Delete
If I just delete Soft Delete v1.1 (PHP Files) (without deactivating the plugin), will it damage my forum?
07-10-2010 07:32 AM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Online
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #20
RE: Soft Delete
Don't know why you'd do that, but it *might* be fine, except it leaving random traces of the plugin here and there.

I don't recommend it however.

My Blog
(This post was last modified: 07-10-2010 09:43 AM by ZiNgA BuRgA.)
07-10-2010 09:43 AM
Find all posts by this user Quote this message in a reply


Forum Jump: