Changeset 4524
- Timestamp:
- 11/26/2012 05:43:43 PM (11 years ago)
- Location:
- trunk/includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/forums/functions.php
r4508 r4524 1944 1944 return; 1945 1945 1946 // Forum is being permanently deleted, so its topics gotta go too 1947 if ( $topics = new WP_Query( array( 1946 // Forum is being permanently deleted, so its content has go too 1947 // Note that we get all post statuses here 1948 $topics = new WP_Query( array( 1948 1949 'suppress_filters' => true, 1949 1950 'post_type' => bbp_get_topic_post_type(), 1950 1951 'post_parent' => $forum_id, 1951 'post_status' => 'any',1952 'post_status' => array_keys( get_post_stati() ), 1952 1953 'posts_per_page' => -1, 1953 1954 'nopaging' => true, 1954 1955 'fields' => 'id=>parent' 1955 ) ) ) { 1956 ) ); 1957 1958 // Loop through and delete child topics. Topic replies will get deleted by 1959 // the bbp_delete_topic() action. 1960 if ( !empty( $topics->posts ) ) { 1956 1961 foreach ( $topics->posts as $topic ) { 1957 1962 wp_delete_post( $topic->ID, true ); … … 1961 1966 wp_reset_postdata(); 1962 1967 } 1968 1969 // Cleanup 1970 unset( $topics ); 1963 1971 } 1964 1972 -
trunk/includes/topics/functions.php
r4522 r4524 2935 2935 2936 2936 // Topic is being permanently deleted, so its replies gotta go too 2937 if ( $replies = new WP_Query( array( 2937 // Note that we get all post statuses here 2938 $replies = new WP_Query( array( 2938 2939 'suppress_filters' => true, 2939 2940 'post_type' => bbp_get_reply_post_type(), 2940 'post_status' => 'any',2941 'post_status' => array_keys( get_post_stati() ), 2941 2942 'post_parent' => $topic_id, 2942 2943 'posts_per_page' => -1, 2943 2944 'nopaging' => true, 2944 2945 'fields' => 'id=>parent' 2945 ) ) ) { 2946 ) ); 2947 2948 // Loop through and delete child replies 2949 if ( ! empty( $replies->posts ) ) { 2946 2950 foreach ( $replies->posts as $reply ) { 2947 2951 wp_delete_post( $reply->ID, true ); … … 2951 2955 wp_reset_postdata(); 2952 2956 } 2957 2958 // Cleanup 2959 unset( $replies ); 2953 2960 } 2954 2961 … … 2977 2984 2978 2985 // Topic is being trashed, so its replies are trashed too 2979 if ($replies = new WP_Query( array(2986 $replies = new WP_Query( array( 2980 2987 'suppress_filters' => true, 2981 2988 'post_type' => bbp_get_reply_post_type(), … … 2985 2992 'nopaging' => true, 2986 2993 'fields' => 'id=>parent' 2987 ) ) ) { 2994 ) ); 2995 2996 if ( !empty( $replies->posts ) ) { 2988 2997 2989 2998 // Prevent debug notices … … 3004 3013 wp_reset_postdata(); 3005 3014 } 3015 3016 // Cleanup 3017 unset( $replies ); 3006 3018 } 3007 3019
Note: See TracChangeset
for help on using the changeset viewer.