Skip to:
Content

bbPress.org

Changeset 7319


Ignore:
Timestamp:
06/27/2025 09:55:09 PM (5 months ago)
Author:
johnjamesjacoby
Message:

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.

Location:
branches/2.6/src/includes
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/2.6/src/includes/forums/functions.php

    r7300 r7319  
    316316        do_action( 'bbp_new_forum', array(
    317317            'forum_id'           => $forum_id,
    318             'post_parent'        => $forum_parent_id,
    319             'forum_author'       => $forum_author,
     318            'post_parent'        => $forum_data['post_parent'],
     319            'forum_author'       => $forum_data['post_author'],
    320320            'last_topic_id'      => 0,
    321321            'last_reply_id'      => 0,
     
    384384    // Define local variable(s)
    385385    $anonymous_data = array();
    386     $forum = $forum_id = $forum_parent_id = 0;
     386    $forum = $forum_id = $forum_author = $forum_parent_id = 0;
    387387    $forum_title = $forum_content = $forum_edit_reason = '';
    388388
     
    422422        remove_filter( 'bbp_edit_forum_pre_content', 'bbp_filter_kses', 30 );
    423423    }
     424
     425    // Get forum author
     426    $forum_author = bbp_get_forum_author_id( $forum_id );
    424427
    425428    /** Forum Parent ***********************************************************/
     
    519522        'post_content' => $forum_content,
    520523        'post_status'  => $forum_status,
    521         'post_parent'  => $forum_parent_id
     524        'post_parent'  => $forum_parent_id,
     525        'post_author'  => $forum_author
    522526    ) );
    523527
     
    532536        do_action( 'bbp_edit_forum', array(
    533537            'forum_id'           => $forum_id,
    534             'post_parent'        => $forum_parent_id,
    535             'forum_author'       => $forum->post_author,
     538            'post_parent'        => $forum_data['post_parent'],
     539            'forum_author'       => $forum_data['post_author'],
    536540            'last_topic_id'      => 0,
    537541            'last_reply_id'      => 0,
  • branches/2.6/src/includes/replies/functions.php

    r7292 r7319  
    463463        /** Update counts, etc... *********************************************/
    464464
    465         do_action( 'bbp_new_reply', $reply_id, $topic_id, $forum_id, $anonymous_data, $reply_author, false, $reply_to );
     465        do_action( 'bbp_new_reply', $reply_id, $topic_id, $forum_id, $anonymous_data, $reply_data['post_author'], false, $reply_to );
    466466
    467467        /** Additional Actions (After Save) ***********************************/
     
    744744
    745745        // Update counts, etc...
    746         do_action( 'bbp_edit_reply', $reply_id, $topic_id, $forum_id, $anonymous_data, $reply_author , true, $reply_to );
     746        do_action( 'bbp_edit_reply', $reply_id, $topic_id, $forum_id, $anonymous_data, $reply_data['post_author'], true, $reply_to );
    747747
    748748        /** Revisions *********************************************************/
  • branches/2.6/src/includes/topics/functions.php

    r7255 r7319  
    374374        /** Update counts, etc... *********************************************/
    375375
    376         do_action( 'bbp_new_topic', $topic_id, $forum_id, $anonymous_data, $topic_author );
     376        do_action( 'bbp_new_topic', $topic_id, $forum_id, $anonymous_data, $topic_data['post_author'] );
    377377
    378378        /** Additional Actions (After Save) ***********************************/
     
    665665
    666666        // Update counts, etc...
    667         do_action( 'bbp_edit_topic', $topic_id, $forum_id, $anonymous_data, $topic_author , true /* Is edit */ );
     667        do_action( 'bbp_edit_topic', $topic_id, $forum_id, $anonymous_data, $topic_data['post_author'], true /* Is edit */ );
    668668
    669669        /** Revisions *********************************************************/
Note: See TracChangeset for help on using the changeset viewer.