Skip to:
Content

bbPress.org

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's profile r-a-y Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 2.6.0
Component: API - Moderation Keywords: has-patch
Cc:

Description

Related: #3349, #3352

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:

  1. 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
  1. 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:

  1. When wp_insert_post() is used in the post handlers, a pending post is still considered successful and no error checks are added.
  2. 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:

https://i.postimg.cc/HxX5HkhK/mod-reply-notice.png

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.

Attachments (2)

3353.reply.patch (1.7 KB) - added by r-a-y 5 years ago.
3353.2.patch (6.8 KB) - added by johnjamesjacoby 4 years ago.

Download all attachments as: .zip

Change History (3)

@r-a-y
5 years ago

#1 @johnjamesjacoby
4 years ago

3353.2.patch iterates on @r-a-y's patch in the following ways

  • Moves the bbp_add_error() call to after the bbp_has_errors() trap, so that it does not bail out early
  • Updates forum/topic/reply post content helpers so they are all the same
  • Introduces bbp_has_error() to check for a specific error code
  • Add similar support for topics and replies (forums don't really work the same way)

This 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.

Last edited 4 years ago by johnjamesjacoby (previous) (diff)
Note: See TracTickets for help on using tickets.