Untrashed comments could be deleted by wp_scheduled_delete()
|Reported by:||nacin||Owned by:|
If you trash a comment, then change its comment status (say to approved) without running wp_untrash_comment(), the _wp_trash_meta_time comment meta will still exist.
wp_scheduled_delete() will then delete the comment once the comment meta time is old enough.
This isn't as much of an edge case, nor does it require a direct DB edit or for a plugin to get involved. The comment.php AYS form (when clicking a link in wp_notify_moderator() email) doesn't check what the comment's current status is. Thus, if the comment was already trashed, and it is then approved, wp_untrash_comment() will not be run and the comment meta will still exist.
First solution, prevent the blocker:
Have wp_scheduled_delete() also check whether the comment is currently in trash.
Second solution, prevent the whole situation from occurring, which would be good for 3.0:
Implement #11441: Comment moderation AYS should provide feedback on comment's current status. I hinted to this blocker in that ticket without realizing it was a blocker:
(For example, a trashed comment would need to first be untrashed before being approved. This doesn't happen now, which means meta is not cleaned up, etc.)
Working on a quick patch for wp_scheduled_delete() now.
Change History (29)
comment:22 azaozz — 4 years ago
- Keywords needs-patch added; has-patch removed
- Severity changed from blocker to normal