Changeset 6717 for trunk/src/includes/replies/functions.php
- Timestamp:
- 09/27/2017 07:23:53 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/replies/functions.php
r6714 r6717 2216 2216 } 2217 2217 2218 // Get the current reply position 2219 $current_position = get_post_field( 'menu_order', $reply_id ); 2220 2221 // Bail if no change 2222 if ( $reply_position === $current_position ) { 2223 return false; 2224 } 2225 2226 // Filters not removed 2227 $removed = false; 2228 2218 2229 // Toggle revisions off as we are not altering content 2219 if ( post_type_supports( bbp_get_reply_post_type(), 'revisions' ) ) {2220 $re visions_removed = true;2221 remove_ post_type_support( bbp_get_reply_post_type(), 'revisions');2230 if ( has_filter( 'clean_post_cache', 'bbp_clean_post_cache' ) ) { 2231 $removed = true; 2232 remove_filter( 'clean_post_cache', 'bbp_clean_post_cache', 10, 2 ); 2222 2233 } 2223 2234 2224 2235 // Update the replies' 'menu_order' with the reply position 2225 wp_update_post( array( 2226 'ID' => $reply_id, 2227 'menu_order' => $reply_position 2228 ) ); 2236 $bbp_db = bbp_db(); 2237 $bbp_db->update( $bbp_db->posts, array( 'menu_order' => $reply_position ), array( 'ID' => $reply_id ) ); 2238 clean_post_cache( $reply_id ); 2229 2239 2230 2240 // Toggle revisions back on 2231 if ( true === $re visions_removed ) {2232 $re visions_removed = false;2233 add_ post_type_support( bbp_get_reply_post_type(), 'revisions');2241 if ( true === $removed ) { 2242 $removed = false; 2243 add_filter( 'clean_post_cache', 'bbp_clean_post_cache', 10, 2 ); 2234 2244 } 2235 2245 … … 2249 2259 2250 2260 // Get required data 2261 $reply_position = 0; 2251 2262 $reply_id = bbp_get_reply_id( $reply_id ); 2252 $topic_id = ! empty( $topic_id ) ? bbp_get_topic_id( $topic_id ) : bbp_get_reply_topic_id( $reply_id ); 2253 $reply_position = 0; 2263 $topic_id = ! empty( $topic_id ) 2264 ? bbp_get_topic_id( $topic_id ) 2265 : bbp_get_reply_topic_id( $reply_id ); 2254 2266 2255 2267 // If reply is actually the first post in a topic, return 0
Note: See TracChangeset
for help on using the changeset viewer.