From 88f779c3433c8437a98e48cf774207dd2d072d3b Mon Sep 17 00:00:00 2001 From: ryan Date: Mon, 23 Jun 2008 22:25:27 +0000 Subject: [PATCH] don't show autosave message if post and autosave are 'identical'. Props mdawaffe. see #6775 git-svn-id: http://svn.automattic.com/wordpress/trunk@8175 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/edit-form-advanced.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php index e87945e81..bb629f421 100644 --- a/wp-admin/edit-form-advanced.php +++ b/wp-admin/edit-form-advanced.php @@ -22,8 +22,17 @@ if ( !isset($post_ID) || 0 == $post_ID ) { $form_action = 'editpost'; $form_extra = ""; $autosave = wp_get_post_autosave( $post_id ); - if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt ) > mysql2date( 'U', $post->post_modified_gmt ) ) - $notice = sprintf( $notices[1], get_edit_post_link( $autosave->ID ) ); + + // Detect if there exists an autosave newer than the post and if that autosave is different than the post + if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt ) > mysql2date( 'U', $post->post_modified_gmt ) ) { + foreach ( _wp_post_revision_fields() as $autosave_field => $_autosave_field ) { + if ( wp_text_diff( $autosave->$autosave_field, $post->$autosave_field ) ) { + $notice = sprintf( $notices[1], get_edit_post_link( $autosave->ID ) ); + break; + } + } + unset($autosave_field, $_autosave_field); + } } ?>