Skip to:
Content

bbPress.org

Changeset 6269


Ignore:
Timestamp:
01/30/2017 11:02:04 PM (3 years ago)
Author:
johnjamesjacoby
Message:

Topics: get a fresh value for redirect_to when trashing/untrashing/deleting.

Fixes a bug where trashing a topic theme-side would redirect to the prefetched topic URL and 404.

(In the case of trashed topics, since WordPress 4.7, the slug receives a __trashed suffix, changing the topic link.)

Fixes #3051.

File:
1 edited

Legend:

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

    r6254 r6269  
    23302330                    check_ajax_referer( "trash-{$nonce_suffix}" );
    23312331
    2332                     $retval['view_all'] = true;
    2333                     $retval['status']   = wp_trash_post( $r['id'] );
    2334                     $retval['message']  = __( '<strong>ERROR</strong>: There was a problem trashing the topic.', 'bbpress' );
     2332                    $retval['view_all']    = true;
     2333                    $retval['status']      = wp_trash_post( $r['id'] );
     2334                    $retval['message']     = __( '<strong>ERROR</strong>: There was a problem trashing the topic.', 'bbpress' );
     2335                    $retval['redirect_to'] = bbp_get_topic_permalink( $r['id'] );
    23352336
    23362337                    break;
     
    23392340                    check_ajax_referer( "untrash-{$nonce_suffix}" );
    23402341
    2341                     $retval['status']  = wp_untrash_post( $r['id'] );
    2342                     $retval['message'] = __( '<strong>ERROR</strong>: There was a problem untrashing the topic.', 'bbpress' );
     2342                    $retval['status']      = wp_untrash_post( $r['id'] );
     2343                    $retval['message']     = __( '<strong>ERROR</strong>: There was a problem untrashing the topic.', 'bbpress' );
     2344                    $retval['redirect_to'] = bbp_get_topic_permalink( $r['id'] );
    23432345
    23442346                    break;
     
    23472349                    check_ajax_referer( "delete-{$nonce_suffix}" );
    23482350
    2349                     $retval['status']  = wp_delete_post( $r['id'] );
    2350                     $retval['message'] = __( '<strong>ERROR</strong>: There was a problem deleting the topic.', 'bbpress' );
     2351                    $retval['status']      = wp_delete_post( $r['id'] );
     2352                    $retval['message']     = __( '<strong>ERROR</strong>: There was a problem deleting the topic.', 'bbpress' );
     2353                    $retval['redirect_to'] = bbp_get_forum_permalink( $retval['status']->post_parent );
    23512354
    23522355                    break;
     
    23542357
    23552358            break;
    2356     }
    2357 
    2358     // Maybe redirect back to the topic's forum
    2359     if ( isset( $r['sub_action'] ) && ( 'delete' === $r['sub_action'] ) ) {
    2360         $retval['redirect_to'] = bbp_get_forum_permalink( $retval['status']->post_parent );
    23612359    }
    23622360
Note: See TracChangeset for help on using the changeset viewer.