Forum Replies Created
Viewing 2 replies - 1 through 2 (of 2 total)
-
In reply to: Infinite loop on reply update
because i cant edit my reply my correction:
function bbp_update_reply_position( $reply_id = 0, $reply_position = 0 ) { global $wpdb; // Bail if reply_id is empty $reply_id = bbp_get_reply_id( $reply_id ); if ( empty( $reply_id ) ) return false; // If no position was passed, get it from the db and update the menu_order if ( empty( $reply_position ) ) { $reply_position = bbp_get_reply_position_raw( $reply_id, bbp_get_reply_topic_id( $reply_id ) ); } $db_menu_order = $wpdb->get_var("select menu_order from {$wpdb->posts} where ID={$reply_id}"); if($db_menu_order == $reply_position) return (int) $reply_position; // Update the replies' 'menp_order' with the reply position wp_update_post( array( 'ID' => $reply_id, 'menu_order' => $reply_position ) ); return (int) $reply_position; }
In reply to: Infinite loop on reply updateI would propose following changes in bbp_update_reply_position in bbpress/replies/functions.php:2128.
function bbp_update_reply_position( $reply_id = 0, $reply_position = 0 ) { // Bail if reply_id is empty $reply_id = bbp_get_reply_id( $reply_id ); if ( empty( $reply_id ) ) return false; // If no position was passed, get it from the db and update the menu_order if ( empty( $reply_position ) ) { $reply_position = bbp_get_reply_position_raw( $reply_id, bbp_get_reply_topic_id( $reply_id ) ); } $post = get_post($reply_id); if($post->menu_order == $reply_position) return (int) $reply_position; // Update the replies' 'menp_order' with the reply position wp_update_post( array( 'ID' => $reply_id, 'menu_order' => $reply_position ) ); return (int) $reply_position; }
Viewing 2 replies - 1 through 2 (of 2 total)