Changeset 18823 for trunk/wp-admin/includes/post.php
- Timestamp:
- 09/29/2011 09:47:52 PM (15 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/includes/post.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/post.php
r18796 r18823 229 229 230 230 wp_update_post( $post_data ); 231 232 // Reunite any orphaned attachments with their parent233 if ( !$draft_ids = get_user_option( 'autosave_draft_ids' ) )234 $draft_ids = array();235 if ( $draft_temp_id = (int) array_search( $post_ID, $draft_ids ) )236 _relocate_children( $draft_temp_id, $post_ID );237 231 238 232 // Now that we have an ID we can fix any attachment anchor hrefs … … 539 533 global $user_ID; 540 534 541 542 535 if ( isset($_POST['post_type']) ) 543 536 $ptype = get_post_type_object($_POST['post_type']); … … 557 550 unset( $_POST['filter'] ); 558 551 559 // Check for autosave collisions560 // Does this need to be updated? ~ Mark561 $temp_id = false;562 if ( isset($_POST['temp_ID']) ) {563 $temp_id = (int) $_POST['temp_ID'];564 if ( !$draft_ids = get_user_option( 'autosave_draft_ids' ) )565 $draft_ids = array();566 foreach ( $draft_ids as $temp => $real )567 if ( time() + $temp > 86400 ) // 1 day: $temp is equal to -1 * time( then )568 unset($draft_ids[$temp]);569 570 if ( isset($draft_ids[$temp_id]) ) { // Edit, don't write571 $_POST['post_ID'] = $draft_ids[$temp_id];572 unset($_POST['temp_ID']);573 update_user_option( $user_ID, 'autosave_draft_ids', $draft_ids );574 return edit_post();575 }576 }577 578 552 // Edit don't write if we have a post id. 579 if ( isset( $_POST['ID'] ) ) { 580 $_POST['post_ID'] = $_POST['ID']; 581 unset ( $_POST['ID'] ); 582 } 583 if ( isset( $_POST['post_ID'] ) ) { 553 if ( isset( $_POST['post_ID'] ) ) 584 554 return edit_post(); 585 }586 555 587 556 $translated = _wp_translate_postdata( false ); … … 617 586 add_post_meta( $post_ID, '_edit_last', $GLOBALS['current_user']->ID ); 618 587 619 // Reunite any orphaned attachments with their parent620 // Does this need to be updated? ~ Mark621 if ( !$draft_ids = get_user_option( 'autosave_draft_ids' ) )622 $draft_ids = array();623 if ( $draft_temp_id = (int) array_search( $post_ID, $draft_ids ) )624 _relocate_children( $draft_temp_id, $post_ID );625 if ( $temp_id && $temp_id != $draft_temp_id )626 _relocate_children( $temp_id, $post_ID );627 628 // Update autosave collision detection629 if ( $temp_id ) {630 $draft_ids[$temp_id] = $post_ID;631 update_user_option( $user_ID, 'autosave_draft_ids', $draft_ids );632 }633 634 588 // Now that we have an ID we can fix any attachment anchor hrefs 635 589 _fix_attachment_links( $post_ID ); … … 644 598 * 645 599 * @since 2.0.0 646 * 600 601 * @uses wp_write_post() 602 * @uses is_wp_error() 603 * @uses wp_die() 647 604 * @return unknown 648 605 */ … … 1323 1280 * @since 2.7.0 1324 1281 * 1325 * @uses wp_write_post()1282 * @uses get_post_status() 1326 1283 * @uses edit_post() 1327 1284 * @uses get_post() 1328 1285 * @uses current_user_can() 1286 * @uses wp_die() 1329 1287 * @uses wp_create_post_autosave() 1288 * @uses add_query_arg() 1289 * @uses wp_create_nonce() 1330 1290 * 1331 1291 * @return str URL to redirect to show the preview
Note: See TracChangeset
for help on using the changeset viewer.