Skip to:
Content

bbPress.org


Ignore:
Timestamp:
05/13/2015 12:34:42 AM (10 years ago)
Author:
johnjamesjacoby
Message:

Replies: Improve type-casting in reply functions. Also use newly created bbp_update_reply_to_id() function in bbp_update_reply_to().

Props thebrandonallen, netweb. See #2801.

File:
1 edited

Legend:

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

    r5691 r5737  
    10351035
    10361036        // Get ancestors
    1037         $ancestors = (array) get_post_ancestors( $reply_id );
     1037        $ancestors = get_post_ancestors( $reply_id );
    10381038
    10391039        // Loop through ancestors
     
    10531053
    10541054    // Update the forum ID
    1055     bbp_update_forum_id( $reply_id, $forum_id );
    1056 
    1057     return apply_filters( 'bbp_update_reply_forum_id', (int) $forum_id, $reply_id );
     1055    $forum_id = bbp_update_forum_id( $reply_id, $forum_id );
     1056
     1057    return (int) apply_filters( 'bbp_update_reply_forum_id', $forum_id, $reply_id );
    10581058}
    10591059
     
    11021102
    11031103    // Update the topic ID
    1104     bbp_update_topic_id( $reply_id, $topic_id );
    1105 
    1106     return apply_filters( 'bbp_update_reply_topic_id', (int) $topic_id, $reply_id );
     1104    $topic_id = bbp_update_topic_id( $reply_id, $topic_id );
     1105
     1106    return apply_filters( 'bbp_update_reply_topic_id', $topic_id, $reply_id );
    11071107}
    11081108
     
    11301130
    11311131        // Update the reply to
    1132         if ( !empty( $reply_to ) ) {
    1133             update_post_meta( $reply_id, '_bbp_reply_to', $reply_to );
     1132        if ( ! empty( $reply_to ) ) {
     1133            $reply_to = bbp_update_reply_to_id( $reply_id, $reply_to );
    11341134
    11351135        // Delete the reply to
     
    11391139    }
    11401140
    1141     return (int) apply_filters( 'bbp_update_reply_to', (int) $reply_to, $reply_id );
     1141    return (int) apply_filters( 'bbp_update_reply_to', $reply_to, $reply_id );
    11421142}
    11431143
     
    11881188    }
    11891189
    1190     return apply_filters( 'bbp_get_reply_ancestors', $ancestors, $reply_id );
     1190    return (array) apply_filters( 'bbp_get_reply_ancestors', $ancestors, $reply_id );
    11911191}
    11921192
Note: See TracChangeset for help on using the changeset viewer.