Skip to:
Content

bbPress.org


Ignore:
Timestamp:
06/27/2025 09:54:08 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 trunk, for 2.7.

Fixes #3578.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/forums/functions.php

    r7299 r7318  
    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,
Note: See TracChangeset for help on using the changeset viewer.