Skip to:
Content

bbPress.org

Ticket #2529: 2529.01.diff

File 2529.01.diff, 907 bytes (added by thebrandonallen, 7 years ago)
  • includes/replies/functions.php

    diff --git includes/replies/functions.php includes/replies/functions.php
    index dbb8e80..90f8510 100644
    function bbp_toggle_reply_handler( $action = '' ) { 
    15741574                                case 'delete':
    15751575                                        check_ajax_referer( 'delete-' . bbp_get_reply_post_type() . '_' . $reply_id );
    15761576
     1577                                        // Set forum/topic ids, as deleting the reply prevents retrieval
     1578                                        $forum_id = bbp_get_reply_forum_id( $reply_id );
     1579                                        $topic_id = bbp_get_reply_topic_id( $reply_id );
     1580
    15771581                                        $success = wp_delete_post( $reply_id );
    15781582                                        $failure = __( '<strong>ERROR</strong>: There was a problem deleting the reply!', 'bbpress' );
    15791583
     1584                                        // On success, update forum/topic meta
     1585                                        if ( ( false !== $success ) && !is_wp_error( $success ) ) {
     1586                                                bbp_update_reply_walker( $reply_id, '', $forum_id, $topic_id, false );
     1587                                        }
     1588
    15801589                                        break;
    15811590                        }
    15821591