When a comment is spammed/trashed, change the parent of it's children
|Reported by:||Viper007Bond||Owned by:|
When removing (spam/trash) a comment that has children, everything goes to hell in terms of hierarchy and you're left with a bunch of orphaned comments.
See two attached images for what currently happens after removing a comment that has children.
When a comment is removed, all immediate children of the comment to be removed should have their parent changed that of the the parent of the comment being removed (or top level if the comment to be removed is top level). Each comment that has it's parent changed then gets that action logged to it's post meta so that it can be moved back in the case of it's previous comment being restored (on post un-delete/spam, find all matching comment metas).