Skip to:
Content

bbPress.org

Opened 7 years ago

Closed 21 hours ago

Last modified 4 hours ago

#3353 closed defect (bug) (fixed)

Template notice not shown when a forum post is moderated

Reported by: r-a-y Owned by: johnjamesjacoby
Priority: normal Milestone: 2.6.20
Component: API - Moderation Version: 2.6.0
Severity: normal 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 7 years ago.
3353.2.patch​ (6.8 KB ) - added by johnjamesjacoby 6 years ago.

Download all attachments as: .zip

Change History (8)

@r-a-y
7 years ago

#1 @johnjamesjacoby
6 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 6 years ago by johnjamesjacoby (previous) (diff)

#2 @johnjamesjacoby
25 hours ago

  • Milestone Awaiting Review → 2.6.20

#3 @johnjamesjacoby
21 hours ago

In 7861:

Moderation: Show notices for pending submissions.

Stop redirecting after a newly submitted topic or reply is held for moderation. This keeps the notice in the current request and clears successful form input to avoid duplicate submissions.

In trunk, for 2.7.

Props r-a-y.
See #3353.

#4 @johnjamesjacoby
21 hours ago

  • Owner set to johnjamesjacoby
  • Resolution → fixed
  • Status new → closed

In 7862:

Moderation: Show notices for pending submissions.

Stop redirecting after a newly submitted topic or reply is held for moderation. This keeps the notice in the current request and clears successful form input to avoid duplicate submissions.

In branches/2.6, for 2.6.20.

Props r-a-y.
Fixes #3353.

#5 @johnjamesjacoby
4 hours ago

In 7864:

Moderation: Avoid returning after pending notices.

Keep pending submissions in the current request without using the error queue as a control-flow boundary. Only enter redirect handling for submissions that are not pending moderation.

In trunk, for 2.7.

See #3353.

#6 @johnjamesjacoby
4 hours ago

In 7865:

Moderation: Avoid returning after pending notices.

Keep pending submissions in the current request without using the error queue as a control-flow boundary. Only enter redirect handling for submissions that are not pending moderation.

In branches/2.6, for 2.6.20.

See #3353.

Note: See TracTickets for help on using tickets.