Skip to:
Content

bbPress.org

Opened 15 months ago

Closed 7 months ago

#3252 closed defect (fixed)

404 page received when author calls post with pending status

Reported by: wpturk Owned by: johnjamesjacoby
Milestone: 2.6 Priority: normal
Severity: normal Version: trunk
Component: Component - Topics Keywords: needs-patch
Cc:

Description

I have the latest version 2.6 RC7

If a post goes to status=pending the author directly gets 404 page.

ex: the pending post called by author : example.com/forum/?post_type=topic&p=xxxxx is directed to 404 page.

I use moderation tools plugin and when a user submits a topic, the user sees directly a 404 page due to the problem above.

My test environment is version: 2.6 RC5 and there it's working fine. Authors can see their pending posts.

Please, let me know, if there is a quick fix?

Change History (3)

#1 @wpturk
15 months ago

  • Component changed from General to Component - Topics
  • Keywords needs-patch added
  • Priority changed from highest to normal
  • Severity changed from blocker to normal

It took me some hours but I found the code snippet which is causing the problem:

includes/topics/capabilities.php:173


                               // User is author so allow edit if not in admin, unless it's past edit lock time
                                } elseif ( ! is_admin() && ( (int) $user_id === (int) $_post->post_author ) ) {

                                        // Only allow if not past the edit-lock period
                                        $caps = ! bbp_past_edit_lock( $_post->post_date_gmt )
                                                ? array( $post_type->cap->edit_posts )
                                                : array( 'do_not_allow' );

Replacing it with the code below fixes the problem:


  // User is author so allow edit if not in admin
                                } elseif ( ! is_admin() && ( (int) $user_id === (int) $_post->post_author ) ) {
                                        $caps = array( $post_type->cap->edit_posts );

#2 @johnjamesjacoby
7 months ago

  • Milestone changed from Awaiting Review to 2.6
  • Owner set to johnjamesjacoby
  • Status changed from new to assigned

#3 @johnjamesjacoby
7 months ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 6921:

Moderation: make sure pending topics (for moderation reasons) are accessible to authors.

This commit updates the logic inside of the topic & reply map-meta-cap implementations, restricting edit-lock checks to actual "Edit" screens, and using the "edit_others_posts" capability in non-"Edit" screens, ensuring that both scenarios are covered.

It also adds an explicit condition for Pending Topics to both the Topic Description and Topic Notices, alerting users as to why they are seeing what they are seeing.

Fixes #3252 (again!) See also #3164 for other related discussion & details.

Note: See TracTickets for help on using tickets.