Skip to:
Content

bbPress.org

Opened 3 years ago

Closed 8 months ago

Last modified 8 months ago

#3578 closed defect (bug) (fixed)

`$topic_author` may be incorrect after the 'bbp_new_topic_pre_insert' filter

Reported by: dd32's profile dd32 Owned by: johnjamesjacoby's profile johnjamesjacoby
Milestone: 2.6.14 Priority: normal
Severity: minor Version: 2.0
Component: API - Actions/Filters Keywords: commit
Cc:

Description (last modified by dd32)

If you use the bbp_new_topic_pre_insert filter to change the authorship of a post (See https://meta.trac.wordpress.org/ticket/6839 for a use-case) the following bbp_new_topic hook will fire with the incorrect data passed.

This is because the hook uses the data from before the filter was run.

As a workaround, one can simply use bbp_get_topic_author_id( $topic_id ) instead of the passed $topic_author of the function.

Note: This applies equally to replies.

I've set the severity to minor, as although it's not ideal, this is not overly unexpected.

Attachments (2)

3578-2.6.patch (3.6 KB) - added by johnjamesjacoby 8 months ago.
Patch for 2.6, covers forums/topics/replies
3578-trunk.patch (3.6 KB) - added by johnjamesjacoby 8 months ago.
For trunk

Download all attachments as: .zip

Change History (6)

#1 @dd32
3 years ago

  • Description modified (diff)

#2 @johnjamesjacoby
8 months ago

  • Keywords commit added
  • Milestone changed from Awaiting Review to 2.6.14
  • Owner set to johnjamesjacoby
  • Status changed from new to assigned
  • Version set to 2.0

@johnjamesjacoby
8 months ago

Patch for 2.6, covers forums/topics/replies

@johnjamesjacoby
8 months ago

For trunk

#3 @johnjamesjacoby
8 months ago

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

In 7318:

API - Actions/Filters: pass filtered author values into actions when adding/editing forums/topics/replies.

This change uses the pre-filtered _data versions of author IDs rather than the original/unfiltered ones, fixing an unintended behavior where the newly filtered author ID was not being used by the subsequent hooked-in functions.

See: https://meta.trac.wordpress.org/ticket/6839

Props dd32.

In trunk, for 2.7.

Fixes #3578.

#4 @johnjamesjacoby
8 months ago

In 7319:

API - Actions/Filters: pass filtered author values into actions when adding/editing forums/topics/replies.

This change uses the pre-filtered _data versions of author IDs rather than the original/unfiltered ones, fixing an unintended behavior where the newly filtered author ID was not being used by the subsequent hooked-in functions.

See: https://meta.trac.wordpress.org/ticket/6839

Props dd32.

In branches/2.6, for 2.6.14.

Fixes #3578.

Note: See TracTickets for help on using tickets.