Skip to:
Content

bbPress.org

Ticket #2817: 2817.diff

File 2817.diff, 1.6 KB (added by tharsheblows, 11 years ago)

return WP_Error object on reply / topic / forum failure

  • src/includes/forums/functions.php

    diff --git a/src/includes/forums/functions.php b/src/includes/forums/functions.php
    index 56ec78c..1f6e94e 100644
    a b function bbp_new_forum_handler( $action = '' ) { 
    261261                'comment_status' => 'closed'
    262262        ) );
    263263
    264         // Insert forum
    265         $forum_id = wp_insert_post( $forum_data );
     264        // Insert forum. Return WP_Error object on failure.
     265        $forum_id = wp_insert_post( $forum_data, true );
    266266
    267267        /** No Errors *************************************************************/
    268268
  • src/includes/replies/functions.php

    diff --git a/src/includes/replies/functions.php b/src/includes/replies/functions.php
    index 4cc223c..7317181 100644
    a b function bbp_insert_reply( $reply_data = array(), $reply_meta = array() ) { 
    4141                'comment_status' => 'closed'
    4242        ), 'insert_reply' );
    4343
    44         // Insert reply
    45         $reply_id = wp_insert_post( $reply_data );
     44        // Insert reply. Return WP_Error object on failure.
     45        $reply_id = wp_insert_post( $reply_data, true );
    4646
    4747        // Bail if no reply was added
    4848        if ( empty( $reply_id ) ) {
  • src/includes/topics/functions.php

    diff --git a/src/includes/topics/functions.php b/src/includes/topics/functions.php
    index 21bfd18..856053e 100644
    a b function bbp_new_topic_handler( $action = '' ) { 
    336336                'comment_status' => 'closed'
    337337        ) );
    338338
    339         // Insert topic
    340         $topic_id = wp_insert_post( $topic_data );
     339        // Insert topic. Return WP_Error object on failure.
     340        $topic_id = wp_insert_post( $topic_data, true );
    341341
    342342        /** No Errors *************************************************************/
    343343