Make WordPress Core

Changeset 8175


Ignore:
Timestamp:
06/23/2008 10:25:27 PM (16 years ago)
Author:
ryan
Message:

don't show autosave message if post and autosave are 'identical'. Props mdawaffe. see #6775

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit-form-advanced.php

    r8032 r8175  
    2323    $form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='$post_ID' />";
    2424    $autosave = wp_get_post_autosave( $post_id );
    25     if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt ) > mysql2date( 'U', $post->post_modified_gmt ) )
    26         $notice = sprintf( $notices[1], get_edit_post_link( $autosave->ID ) );
     25
     26    // Detect if there exists an autosave newer than the post and if that autosave is different than the post
     27    if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt ) > mysql2date( 'U', $post->post_modified_gmt ) ) {
     28        foreach ( _wp_post_revision_fields() as $autosave_field => $_autosave_field ) {
     29            if ( wp_text_diff( $autosave->$autosave_field, $post->$autosave_field ) ) {
     30                $notice = sprintf( $notices[1], get_edit_post_link( $autosave->ID ) );
     31                break;
     32            }
     33        }
     34        unset($autosave_field, $_autosave_field);
     35    }
    2736}
    2837
Note: See TracChangeset for help on using the changeset viewer.