Skip to:
Content

bbPress.org

Changeset 3179


Ignore:
Timestamp:
05/21/2011 07:44:31 AM (11 years ago)
Author:
johnjamesjacoby
Message:

Security sweep and code clean-up through bbp-reply-functions.php. See #1514.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/plugin/bbp-includes/bbp-reply-functions.php

    r3171 r3179  
    2828 */
    2929function bbp_update_reply_forum_id( $reply_id = 0, $forum_id = 0 ) {
     30
     31    // Validation
    3032    $reply_id = bbp_get_reply_id( $reply_id );
    3133    $forum_id = bbp_get_forum_id( $forum_id );
     
    3335    // If no forum_id was passed, walk up ancestors and look for forum type
    3436    if ( empty( $forum_id ) ) {
     37
     38        // Get ancestors
    3539        $ancestors = get_post_ancestors( $reply_id );
     40
     41        // Loop through ancestors
    3642        foreach ( $ancestors as $ancestor ) {
     43
     44            // Get first parent that is a forum
    3745            if ( get_post_field( 'post_type', $ancestor ) == bbp_get_forum_post_type() ) {
    3846                $forum_id = $ancestor;
     47
     48                // Found a forum, so exit the loop and continue
    3949                continue;
    4050            }
     
    4252    }
    4353
    44     // Update the last reply ID
    45     update_post_meta( $reply_id, '_bbp_forum_id', (int) $forum_id );
     54    // Update the forum ID
     55    bbp_update_forum_id( $reply_id, $forum_id );
    4656
    4757    return apply_filters( 'bbp_update_reply_forum_id', (int) $forum_id, $reply_id );
     
    6575 */
    6676function bbp_update_reply_topic_id( $reply_id = 0, $topic_id = 0 ) {
     77
     78    // Validation
    6779    $reply_id = bbp_get_reply_id( $reply_id );
    6880    $topic_id = bbp_get_topic_id( $topic_id );
     
    7082    // If no topic_id was passed, walk up ancestors and look for topic type
    7183    if ( empty( $topic_id ) ) {
     84
     85        // Get ancestors
    7286        $ancestors = get_post_ancestors( $reply_id );
     87
     88        // Loop through ancestors
    7389        foreach ( $ancestors as $ancestor ) {
     90
     91            // Get first parent that is a forum
    7492            if ( get_post_field( 'post_type', $ancestor ) == bbp_get_topic_post_type() ) {
    7593                $topic_id = $ancestor;
     94
     95                // Found a forum, so exit the loop and continue
    7696                continue;
    7797            }
     
    7999    }
    80100
    81     // Update the last reply ID
    82     update_post_meta( $reply_id, '_bbp_topic_id', (int) $topic_id );
     101    // Update the topic ID
     102    bbp_update_topic_id( $reply_id, $topic_id );
    83103
    84104    return apply_filters( 'bbp_update_reply_topic_id', (int) $topic_id, $reply_id );
     
    119139 */
    120140function bbp_new_reply_handler() {
     141
    121142    // Only proceed if POST is a new reply
    122     if ( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && 'bbp-new-reply' === $_POST['action'] ) {
     143    if ( 'POST' == strtoupper( $_SERVER['REQUEST_METHOD'] ) && !empty( $_POST['action'] ) && ( 'bbp-new-reply' === $_POST['action'] ) ) {
    123144        global $bbp;
    124145
     
    126147        check_admin_referer( 'bbp-new-reply' );
    127148
    128         // Prevent debug notices
    129         $topic_id = $forum_id = $reply_content = '';
    130 
    131         // Check users ability to create new reply
    132         if ( !bbp_is_anonymous() ) {
    133             if ( !current_user_can( 'publish_replies' ) )
     149        // Set defaults to prevent debug notices
     150        $topic_id = $forum_id = $topic_author = $anonymous_data = 0;
     151        $reply_title = $reply_content = $terms = '';
     152
     153        /** Reply Author ******************************************************/
     154
     155        // User is anonymous
     156        if ( bbp_is_anonymous() ) {
     157
     158            // Filter anonymous data
     159            $anonymous_data = bbp_filter_anonymous_post_data();
     160
     161            // Anonymous data checks out, so set cookies, etc...
     162            if ( !empty( $anonymous_data ) && is_array( $anonymous_data ) ) {
     163                bbp_set_current_anonymous_user_data( $anonymous_data );
     164            }
     165
     166        // User is logged in
     167        } else {
     168
     169            // User cannot create replies
     170            if ( !current_user_can( 'publish_replies' ) ) {
    134171                $bbp->errors->add( 'bbp_reply_permissions', __( '<strong>ERROR</strong>: You do not have permission to reply.', 'bbpress' ) );
    135 
    136             $anonymous_data = false;
    137             $reply_author   = bbp_get_current_user_id();
    138 
    139         // It is an anonymous post
    140         } else {
    141             $anonymous_data = bbp_filter_anonymous_post_data(); // Filter anonymous data
    142             $reply_author   = 0;
    143 
    144             if ( !empty( $anonymous_data ) && is_array( $anonymous_data ) )
    145                 bbp_set_current_anonymous_user_data( $anonymous_data );
     172            }
     173
     174            // Reply author is current user
     175            $reply_author = bbp_get_current_user_id();
     176
    146177        }
     178
     179        /** Topic ID **********************************************************/
    147180
    148181        // Handle Topic ID to append reply to
     
    150183            $bbp->errors->add( 'bbp_reply_topic_id', __( '<strong>ERROR</strong>: Topic ID is missing.', 'bbpress' ) );
    151184
     185        /** Forum ID **********************************************************/
     186
    152187        // Handle Forum ID to adjust counts of
    153188        if ( isset( $_POST['bbp_forum_id'] ) && ( !$forum_id = (int) $_POST['bbp_forum_id'] ) )
    154189            $bbp->errors->add( 'bbp_reply_forum_id', __( '<strong>ERROR</strong>: Forum ID is missing.', 'bbpress' ) );
     190
     191        /** Unfiltered HTML ***************************************************/
    155192
    156193        // Remove wp_filter_kses filters from title and content for capable users and if the nonce is verified
     
    160197        }
    161198
    162         // Handle Title (optional for replies)
     199        /** Reply Title *******************************************************/
     200
    163201        if ( !empty( $_POST['bbp_reply_title'] ) )
    164202            $reply_title = esc_attr( strip_tags( $_POST['bbp_reply_title'] ) );
    165203
     204        // Filter and sanitize
    166205        $reply_title = apply_filters( 'bbp_new_reply_pre_title', $reply_title );
    167206
    168         // Handle Content
    169         if ( isset( $_POST['bbp_reply_content'] ) && ( !$reply_content = $_POST['bbp_reply_content'] ) ) {
     207        // No reply title
     208        if ( empty( $reply_title ) )
     209            $bbp->errors->add( 'bbp_reply_title', __( '<strong>ERROR</strong>: Your reply needs a title.', 'bbpress' ) );
     210
     211        /** Reply Content *****************************************************/
     212
     213        if ( !empty( $_POST['bbp_reply_content'] ) )
     214            $reply_content = $_POST['bbp_reply_content'];
     215
     216        // Filter and sanitize
     217        $reply_content = apply_filters( 'bbp_new_reply_pre_content', $reply_content );
     218
     219        // No reply content
     220        if ( empty( $reply_content ) )
    170221            $bbp->errors->add( 'bbp_reply_content', __( '<strong>ERROR</strong>: Your reply cannot be empty.', 'bbpress' ) );
    171             $reply_content = '';
    172         }
    173 
    174         $reply_content = apply_filters( 'bbp_new_reply_pre_content', $reply_content );
    175 
    176         // Check for flood
     222
     223        /** Reply Flooding ****************************************************/
     224
    177225        if ( !bbp_check_for_flood( $anonymous_data, $reply_author ) )
    178226            $bbp->errors->add( 'bbp_reply_flood', __( '<strong>ERROR</strong>: Slow down; you move too fast.', 'bbpress' ) );
    179227
    180         // Check for duplicate
     228        /** Reply Duplicate ***************************************************/
     229
    181230        if ( !bbp_check_for_duplicate( array( 'post_type' => bbp_get_reply_post_type(), 'post_author' => $reply_author, 'post_content' => $reply_content, 'post_parent' => $topic_id, 'anonymous_data' => $anonymous_data ) ) )
    182231            $bbp->errors->add( 'bbp_reply_duplicate', __( '<strong>ERROR</strong>: Duplicate reply detected; it looks as though you&#8217;ve already said that!', 'bbpress' ) );
    183232
    184         // Handle Tags
    185         if ( !is_wp_error( $bbp->errors ) || !$bbp->errors->get_error_codes() ) {
    186             if ( isset( $_POST['bbp_topic_tags'] ) ) {
    187                 $tags = esc_attr( strip_tags( $_POST['bbp_topic_tags'] ) );
    188                 $tags = wp_set_post_terms( $topic_id, $tags, $bbp->topic_tag_id, false );
    189 
    190                 if ( is_wp_error( $tags ) )
    191                     $bbp->errors->add( 'bbp_reply_tags', __( '<strong>ERROR</strong>: There was some problem adding the tags to the topic.', 'bbpress' ) );
    192             }
    193         }
     233        /** Topic Tags ********************************************************/
     234
     235        if ( !empty( $_POST['bbp_topic_tags'] ) )
     236            $terms = esc_attr( strip_tags( $_POST['bbp_topic_tags'] ) );
     237
     238        /** Additional Actions (Before Save) **********************************/
     239
     240        do_action( 'bbp_new_reply_pre_extras' );
     241
     242        /** No Errors *********************************************************/
    194243
    195244        // Handle insertion into posts table
    196245        if ( !is_wp_error( $bbp->errors ) || !$bbp->errors->get_error_codes() ) {
     246
     247            /** Create new reply **********************************************/
    197248
    198249            // Add the content of the form to $post as an array
     
    209260            $reply_id = wp_insert_post( $reply_data );
    210261
     262            /** No Errors *****************************************************/
     263
    211264            // Check for missing reply_id or error
    212265            if ( !empty( $reply_id ) && !is_wp_error( $reply_id ) ) {
    213266
     267                /** Topic Tags ************************************************/
     268
     269                // Insert terms
     270                $terms = wp_set_post_terms( $topic_id, $terms, $bbp->topic_tag_id, false );
     271
     272                // Term error
     273                if ( is_wp_error( $terms ) )
     274                    $bbp->errors->add( 'bbp_reply_tags', __( '<strong>ERROR</strong>: There was some problem adding the tags to the topic.', 'bbpress' ) );
     275
    214276                // Update counts, etc...
    215277                do_action( 'bbp_new_reply', $reply_id, $topic_id, $forum_id, $anonymous_data, $reply_author );
    216278
     279                /** Successful Save *******************************************/
     280
    217281                // Redirect back to new reply
    218282                wp_redirect( bbp_get_reply_url( $reply_id ) );
     
    221285                exit();
    222286
    223             // Errors to report
     287            /** Errors ********************************************************/
     288
    224289            } else {
    225290                $append_error = ( is_wp_error( $reply_id ) && $reply_id->get_error_message() ) ? $reply_id->get_error_message() . ' ' : '';
     
    261326 */
    262327function bbp_edit_reply_handler() {
     328
    263329    // Only proceed if POST is an reply request
    264     if ( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && 'bbp-edit-reply' === $_POST['action'] ) {
     330    if ( 'POST' == strtoupper( $_SERVER['REQUEST_METHOD'] ) && !empty( $_POST['action'] ) && ( 'bbp-edit-reply' === $_POST['action'] ) ) {
    265331        global $bbp;
    266332
    267         if ( empty( $_POST['bbp_reply_id'] ) || !$reply_id = (int) $_POST['bbp_reply_id'] ) {
    268             $bbp->errors->add( 'bbp_edit_reply_id', __( '<strong>ERROR</strong>: Reply ID not found!', 'bbpress' ) );
    269         } elseif ( !$reply = bbp_get_reply( $reply_id ) ) {
    270             $bbp->errors->add( 'bbp_edit_reply_not_found', __( '<strong>ERROR</strong>: The reply you want to edit was not found!', 'bbpress' ) );
     333        // Set defaults to prevent debug notices
     334        $reply = $reply_id = $topic_id = $forum_id = $anonymous_data = 0;
     335        $reply_title = $reply_content = $reply_edit_reason = $terms = '';
     336
     337        /** Reply *************************************************************/
     338
     339        // Reply id was not passed
     340        if ( empty( $_POST['bbp_reply_id'] ) )
     341            $bbp->errors->add( 'bbp_edit_reply_id', __( '<strong>ERROR</strong>: Reply ID not found.', 'bbpress' ) );
     342
     343        // Reply id was passed
     344        elseif ( is_numeric( $_POST['bbp_reply_id'] ) )
     345            $reply_id = (int) $_POST['bbp_reply_id'];
     346
     347        // Reply does not exist
     348        if ( !$reply = bbp_get_reply( $reply_id ) ) {
     349            $bbp->errors->add( 'bbp_edit_reply_not_found', __( '<strong>ERROR</strong>: The reply you want to edit was not found.', 'bbpress' ) );
     350
     351        // Reply exists
    271352        } else {
    272353
     
    274355            check_admin_referer( 'bbp-edit-reply_' . $reply_id );
    275356
    276             // Get reply parent ID's
    277             $topic_id = bbp_get_reply_topic_id( $reply_id );
    278             $forum_id = bbp_get_topic_forum_id( $topic_id );
    279 
    280             // Prevent debug notices
    281             $reply_content = '';
    282 
    283357            // Check users ability to create new reply
    284358            if ( !bbp_is_reply_anonymous( $reply_id ) ) {
     359
     360                // User cannot edit this reply
    285361                if ( !current_user_can( 'edit_reply', $reply_id ) ) {
    286                     $bbp->errors->add( 'bbp_edit_reply_permissions', __( '<strong>ERROR</strong>: You do not have permission to edit that reply!', 'bbpress' ) );
     362                    $bbp->errors->add( 'bbp_edit_reply_permissions', __( '<strong>ERROR</strong>: You do not have permission to edit that reply.', 'bbpress' ) );
    287363                }
    288 
    289                 $anonymous_data = false;
    290364
    291365            // It is an anonymous post
    292366            } else {
    293                 $anonymous_data = bbp_filter_anonymous_post_data( array(), true ); // Filter anonymous data
     367
     368                // Filter anonymous data
     369                $anonymous_data = bbp_filter_anonymous_post_data( array(), true );
    294370            }
    295 
    296371        }
    297372
     
    302377        }
    303378
    304         // Handle Title (optional for replies)
    305         $reply_title = !empty( $_POST['bbp_reply_title'] ) ? esc_attr( strip_tags( $_POST['bbp_reply_title'] ) ) : $reply_title = $reply->post_title;
     379        /** Reply Topic *******************************************************/
     380
     381        $topic_id = bbp_get_reply_topic_id( $reply_id );
     382
     383        /** Reply Forum *******************************************************/
     384
     385        $forum_id = bbp_get_topic_forum_id( $topic_id );
     386
     387        // Forum exists
     388        if ( !empty( $forum_id ) && ( $forum_id != $reply->post_parent ) ) {
     389
     390            // Forum is a category
     391            if ( bbp_is_forum_category( $forum_id ) )
     392                $bbp->errors->add( 'bbp_edit_reply_forum_category', __( '<strong>ERROR</strong>: This forum is a category. No topics or replies can be created in it.', 'bbpress' ) );
     393
     394            // Forum is closed and user cannot access
     395            if ( bbp_is_forum_closed( $forum_id ) && !current_user_can( 'edit_forum', $forum_id ) )
     396                $bbp->errors->add( 'bbp_edit_reply_forum_closed', __( '<strong>ERROR</strong>: This forum has been closed to new topics and replies.', 'bbpress' ) );
     397
     398            // Forum is private and user cannot access
     399            if ( bbp_is_forum_private( $forum_id ) && !current_user_can( 'read_private_forums' ) )
     400                $bbp->errors->add( 'bbp_edit_reply_forum_private', __( '<strong>ERROR</strong>: This forum is private and you do not have the capability to read or create new replies in it.', 'bbpress' ) );
     401
     402            // Forum is hidden and user cannot access
     403            if ( bbp_is_forum_hidden( $forum_id ) && !current_user_can( 'read_hidden_forums' ) )
     404                $bbp->errors->add( 'bbp_edit_reply_forum_hidden', __( '<strong>ERROR</strong>: This forum is hidden and you do not have the capability to read or create new replies in it.', 'bbpress' ) );
     405        }
     406
     407        /** Reply Title *******************************************************/
     408
     409        if ( !empty( $_POST['bbp_reply_title'] ) )
     410            $reply_title = esc_attr( strip_tags( $_POST['bbp_reply_title'] ) );
     411
     412        // Filter and sanitize
    306413        $reply_title = apply_filters( 'bbp_edit_reply_pre_title', $reply_title, $reply_id );
    307414
    308         // Handle Content
    309         if ( isset( $_POST['bbp_reply_content'] ) && ( !$reply_content = $_POST['bbp_reply_content'] ) )
     415        /** Reply Content *****************************************************/
     416
     417        if ( !empty( $_POST['bbp_reply_content'] ) )
     418            $reply_content = $_POST['bbp_reply_content'];
     419
     420        // Filter and sanitize
     421        $reply_content = apply_filters( 'bbp_edit_reply_pre_content', $reply_content, $reply_id );
     422
     423        // No reply content
     424        if ( empty( $reply_content ) )
    310425            $bbp->errors->add( 'bbp_edit_reply_content', __( '<strong>ERROR</strong>: Your reply cannot be empty.', 'bbpress' ) );
    311426
    312         $reply_content = apply_filters( 'bbp_edit_reply_pre_content', $reply_content, $reply_id );
    313 
    314         // Handle Tags
    315         if ( !is_wp_error( $bbp->errors ) || !$bbp->errors->get_error_codes() ) {
    316             if ( isset( $_POST['bbp_topic_tags'] ) ) {
    317                 $tags = esc_attr( strip_tags( $_POST['bbp_topic_tags'] ) );
    318                 $tags = wp_set_post_terms( $topic_id, $tags, $bbp->topic_tag_id, false );
    319 
    320                 if ( is_wp_error( $tags ) )
    321                     $bbp->errors->add( 'bbp_reply_tags', __( '<strong>ERROR</strong>: There was some problem adding the tags to the topic.', 'bbpress' ) );
    322             }
    323         }
     427        /** Topic Tags ********************************************************/
     428
     429        if ( !empty( $_POST['bbp_topic_tags'] ) )
     430            $terms = esc_attr( strip_tags( $_POST['bbp_topic_tags'] ) );
     431
     432        /** Additional Actions (Before Save) **********************************/
     433
     434        do_action( 'bbp_edit_reply_pre_extras', $reply_id );
     435
     436        /** No Errors *********************************************************/
    324437
    325438        // Handle insertion into posts table
     
    336449            $reply_id = wp_update_post( $reply_data );
    337450
    338             // Revisions
    339             $reply_edit_reason = !empty( $_POST['bbp_reply_edit_reason'] ) ? esc_attr( strip_tags( $_POST['bbp_reply_edit_reason'] ) ) : '';
    340 
    341             if ( !empty( $_POST['bbp_log_reply_edit'] ) && 1 == $_POST['bbp_log_reply_edit'] && $revision_id = wp_save_post_revision( $reply_id ) )
    342                 bbp_update_reply_revision_log( array( 'reply_id' => $reply_id, 'revision_id' => $revision_id, 'author_id' => bbp_get_current_user_id(), 'reason' => $reply_edit_reason ) );
    343 
    344             // Check for missing reply_id or error
     451            /** Topic Tags ************************************************/
     452
     453            // Insert terms
     454            $terms = wp_set_post_terms( $topic_id, $terms, $bbp->topic_tag_id, false );
     455
     456            // Term error
     457            if ( is_wp_error( $terms ) )
     458                $bbp->errors->add( 'bbp_reply_tags', __( '<strong>ERROR</strong>: There was some problem adding the tags to the topic.', 'bbpress' ) );
     459
     460            /** Revisions *****************************************************/
     461
     462            // Revision Reason
     463            if ( !empty( $_POST['bbp_reply_edit_reason'] ) )
     464                $reply_edit_reason = esc_attr( strip_tags( $_POST['bbp_reply_edit_reason'] ) );
     465
     466            // Update revision log
     467            if ( !empty( $_POST['bbp_log_reply_edit'] ) && ( 1 == $_POST['bbp_log_reply_edit'] ) && ( $revision_id = wp_save_post_revision( $reply_id ) ) ) {
     468                bbp_update_reply_revision_log( array(
     469                    'reply_id'    => $reply_id,
     470                    'revision_id' => $revision_id,
     471                    'author_id'   => bbp_get_current_user_id(),
     472                    'reason'      => $reply_edit_reason
     473                ) );
     474            }
     475
     476            /** No Errors *****************************************************/
     477
    345478            if ( !empty( $reply_id ) && !is_wp_error( $reply_id ) ) {
    346479
     
    348481                do_action( 'bbp_edit_reply', $reply_id, $topic_id, $forum_id, $anonymous_data, $reply->post_author , true /* Is edit */ );
    349482
     483                /** Additional Actions (After Save) ***************************/
     484
     485                do_action( 'bbp_edit_reply_post_extras', $reply_id );
     486
     487                /** Successful Edit *******************************************/
     488
    350489                // Redirect back to new reply
    351490                wp_redirect( bbp_get_reply_url( $reply_id ) );
     
    354493                exit();
    355494
    356             // Errors to report
     495            /** Errors ********************************************************/
     496
    357497            } else {
    358498                $append_error = ( is_wp_error( $reply_id ) && $reply_id->get_error_message() ) ? $reply_id->get_error_message() . ' ' : '';
     
    389529
    390530        // Update the reply meta bidness
    391         bbp_update_reply( $reply_id, (int) $_POST['parent_id'] );
     531        $parent_id = !empty( $_POST['parent_id'] ) ? (int) $_POST['parent_id'] : 0;
     532        bbp_update_topic( $reply_id, $parent_id );
    392533    }
    393534}
     
    465606    if ( bbp_is_subscriptions_active() && !empty( $author_id ) ) {
    466607        $subscribed = bbp_is_user_subscribed( $author_id, $topic_id );
    467         $subscheck  = ( !empty( $_POST['bbp_topic_subscription'] ) && 'bbp_subscribe' == $_POST['bbp_topic_subscription'] ) ? true : false;
     608        $subscheck  = ( !empty( $_POST['bbp_topic_subscription'] ) && ( 'bbp_subscribe' == $_POST['bbp_topic_subscription'] ) ) ? true : false;
    468609
    469610        // Subscribed and unsubscribing
     
    476617    }
    477618
     619    // Reply meta relating to reply position in tree
     620    bbp_update_reply_forum_id( $reply_id, $forum_id );
     621    bbp_update_reply_topic_id( $reply_id, $topic_id );
     622
    478623    // Update associated topic values if this is a new reply
    479624    if ( empty( $is_edit ) ) {
     
    484629        // Last active time
    485630        $last_active_time = current_time( 'mysql' );
    486 
    487         // Reply meta relating to reply position in tree
    488         bbp_update_reply_forum_id( $reply_id, $forum_id );
    489         bbp_update_reply_topic_id( $reply_id, $topic_id );
    490631
    491632        // Walk up ancestors and do the dirty work
     
    675816
    676817    // Only proceed if GET is a reply toggle action
    677     if ( 'GET' == $_SERVER['REQUEST_METHOD'] && !empty( $_GET['action'] ) && in_array( $_GET['action'], array( 'bbp_toggle_reply_spam', 'bbp_toggle_reply_trash' ) ) && !empty( $_GET['reply_id'] ) ) {
     818    if ( 'GET' == strtoupper( $_SERVER['REQUEST_METHOD'] ) && !empty( $_GET['reply_id'] ) && !empty( $_GET['action'] ) && in_array( $_GET['action'], array( 'bbp_toggle_reply_spam', 'bbp_toggle_reply_trash' ) ) ) {
    678819        global $bbp;
    679820
     
    693834        }
    694835
     836        // What action are we trying to perform?
    695837        switch ( $action ) {
    696838
     839            // Toggle spam
    697840            case 'bbp_toggle_reply_spam' :
    698841                check_ajax_referer( 'spam-reply_' . $reply_id );
     
    704847                break;
    705848
     849            // Toggle trash
    706850            case 'bbp_toggle_reply_trash' :
    707851
     
    743887        do_action( 'bbp_toggle_reply_handler', $success, $post_data, $action );
    744888
    745         // Check for errors
     889        // No errors
    746890        if ( ( false != $success ) && !is_wp_error( $success ) ) {
    747891
     
    769913 * @param int $reply_id Reply id
    770914 * @uses wp_get_single_post() To get the reply
    771  * @uses do_action() Calls 'bbp_spam_reply' with the reply id before marking
    772  *                    the reply as spam
     915 * @uses do_action() Calls 'bbp_spam_reply' with the reply ID
    773916 * @uses add_post_meta() To add the previous status to a meta
    774917 * @uses wp_insert_post() To insert the updated post
    775  * @uses do_action() Calls 'bbp_spammed_reply' with the reply id after marking
    776  *                    the reply as spam
     918 * @uses do_action() Calls 'bbp_spammed_reply' with the reply ID
    777919 * @return mixed False or {@link WP_Error} on failure, reply id on success
    778920 */
     
    791933
    792934    $reply['post_status'] = $bbp->spam_status_id;
     935
    793936    $reply_id = wp_insert_post( $reply );
    794937
     
    805948 * @param int $reply_id Reply id
    806949 * @uses wp_get_single_post() To get the reply
    807  * @uses do_action() Calls 'bbp_unspam_reply' with the reply id before unmarking
    808  *                    the reply as spam
     950 * @uses do_action() Calls 'bbp_unspam_reply' with the reply ID
    809951 * @uses get_post_meta() To get the previous status meta
    810952 * @uses delete_post_meta() To delete the previous status meta
    811953 * @uses wp_insert_post() To insert the updated post
    812  * @uses do_action() Calls 'bbp_unspammed_reply' with the reply id after
    813  *                    unmarking the reply as spam
     954 * @uses do_action() Calls 'bbp_unspammed_reply' with the reply ID
    814955 * @return mixed False or {@link WP_Error} on failure, reply id on success
    815956 */
Note: See TracChangeset for help on using the changeset viewer.