Opened 5 years ago
Last modified 4 years ago
#3353 new defect (bug)
Template notice not shown when a forum post is moderated
Reported by: | r-a-y | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 2.6.0 |
Component: | API - Moderation | Keywords: | has-patch |
Cc: |
Description
When a forum post is auto-moderated (a.k.a. post status is pending
), the user is not informed as to why the forum post failed to post. It just looks like the page refreshed.
Looks like this issue has been this way since v2.1.0, but hasn't really surfaced until now due to how the blog comment moderation settings are now inherited in v2.6.0.
To duplicate:
- When logged-in as a regular user, attempt to create a forum post with two links on separate lines:
- * As a forum reply to a topic in any forum (BuddyPress group or regular forum)
- * As a forum topic in a BuddyPress group forum
- Submit the form and you'll see no notice or forum post.
For regular forum topics that are moderated (those not connected to a BuddyPress group forum), a notice does show though.
There are two problems:
- When
wp_insert_post()
is used in the post handlers, apending
post is still considered successful and no error checks are added. - When redirection occurs after the post is created (such as for BuddyPress group forums), the template notice will not persist because it's only meant for the initial pageload.
The attached patch fixes this for forum replies. There is one issue though; the template notice is displayed in the form and not above the fold:
The notice should probably show up above the fold like the other template notices.
I haven't had time to look into the BuddyPress group topic problem yet, but I'll look into it soon.
3353.2.patch iterates on @r-a-y's patch in the following ways
bbp_add_error()
call to after thebbp_has_errors()
trap, so that it does not bail out earlybbp_has_error()
to check for a specific error codeThis allows for legitimate content errors to continue to retain the posted content without losing it in the event of a non-moderation error, while also adding moderation notice support for both post types.