Skip to:
Content

bbPress.org

Ticket #2243: replies-functions.patch

File replies-functions.patch, 1.6 KB (added by alex-ye, 9 years ago)
  • functions.php

    # This patch file was generated by NetBeans IDE
    # Following Index: paths are relative to: \includes\replies
    # This patch can be applied using context Tools: Patch action on respective folder.
    # It uses platform neutral UTF-8 encoding and \n newlines.
    # Above lines and this line are ignored by the patching process.
     
    610610
    611611        if ( !empty( $reply_id ) && !is_wp_error( $reply_id ) ) {
    612612
     613                /** Spam Check ********************************************************/
     614
     615                // If reply or topic are spam, officially spam this reply
     616                if ( $reply_data['post_status'] == bbp_get_spam_status_id() || bbp_is_topic_spam( $topic_id ) ) {
     617                        update_post_meta( $reply_id, '_bbp_spam_meta_status', bbp_get_public_status_id() );
     618
     619                        // Only add to pre-spammed array if topic is spam
     620                        if ( bbp_is_topic_spam( $topic_id ) ) {
     621
     622                                // Get pre_spammed_replies for topic
     623                                $pre_spammed_replies = get_post_meta( $topic_id, '_bbp_pre_spammed_replies', true );
     624
     625                                // Add this reply to the end of the existing replies
     626                                $pre_spammed_replies[] = $reply_id;
     627
     628                                // Update the pre_spammed_replies post meta
     629                                update_post_meta( $topic_id, '_bbp_pre_spammed_replies', $pre_spammed_replies );
     630                               
     631                                // Cleanup
     632                                unset( $pre_spammed_replies );
     633                        }
     634                }
     635               
    613636                // Update counts, etc...
    614637                do_action( 'bbp_edit_reply', $reply_id, $topic_id, $forum_id, $anonymous_data, $reply_author , true /* Is edit */ );
    615638