Relocate or delete topics on forum deletion to avoid leaving stale data in database.

Created on 6 January 2008, almost 17 years ago
Updated 4 May 2024, 8 months ago

While setting up a view today, I suddenly discovered 200 forum posts from a forum I deleted over year ago (on a 5.x site). This is because forum.module doesn't delete posts when you delete a forum, even though it says it does, leaving potentially thousands of orphaned nodes in the database (and otherwise difficult to find - none of the filter settings in admin/content/content will find them for example because they're not in a term to be filtered by).

To reproduce. Create one forum. Post one forum topic in it. Delete the forum in admin/content/forum/edit/forum/1 and see this message:

Deleting a forum or container will also delete its sub-forums and posts, if any. This action cannot be undone.
After you delete, go back to admin/content/node and your post will still be there.

http://api.drupal.org/api/function/forum_confirm_delete_submit/6 doesn't make any attempt to delete any nodes at all, and hasn't since it was introduced.

If this is by design, then the message shouldn't say "delete [...] posts" because it's not doing that. But really, if you delete a forum, you ought to be able to delete all the posts at the same time rather than go separately to admin/content/node beforehand. The main issue though, is you can't go back and delete those forum posts all together once you've deleted the forum not possible afterwards because you can no longer filter by that term.

At this stage in the release cycle, and especially now there's multiple node types in forums, I'm tempted to just submit a patch for the string and revisit in D7. Since this has led to 200 stale nodes languishing somewhere in the depths of my db, and only a custom view to get rid of them, I'm marking as critical though. It'll be a trivial fix to the string, probably not straightforward to sort out a delete action.

✨ Feature request
Status

Needs work

Version

2.0

Component

forum.module

Created by

πŸ‡¬πŸ‡§United Kingdom catch

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024