Make WordPress Core

Changeset 7138


Ignore:
Timestamp:
03/03/2008 08:58:06 PM (19 years ago)
Author:
ryan
Message:

Only show "saved at" when the post was actually saved. Props mdawaffe. fixes #6053

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-ajax.php

    r7103 r7138  
    484484        $do_lock = true;
    485485
    486         $data = '<div class="updated"><p>' . sprintf( __('Saved at %s.'), date( __('g:i:s a'), current_time( 'timestamp', true ) ) ) . '</p></div>';
     486        $data = '';
     487        $message = '<div class="updated"><p>' . sprintf( __('Saved at %s.'), date( __('g:i:s a'), current_time( 'timestamp', true ) ) ) . '</p></div>';
    487488
    488489        $supplemental = array();
    … …  
    491492        if($_POST['post_ID'] < 0) {
    492493                $_POST['temp_ID'] = $_POST['post_ID'];
    493                 if ( $do_autosave )
     494                if ( $do_autosave ) {
    494495                        $id = wp_write_post();
     496                        $data = $message;
     497                }
    495498        } else {
    496499                $post_ID = (int) $_POST['post_ID'];
    … …  
    518521                                die(__('You are not allowed to edit this post.'));
    519522                }
    520                 if ( $do_autosave )
     523                if ( $do_autosave ) {
    521524                        $id = wp_update_post($_POST);
    522                 else
     525                        $data = $message;
     526                } else {
    523527                        $id = $post->ID;
     528                }
    524529        }
    525530
  • trunk/wp-includes/js/autosave.js

    r7130 r7138  
    1818// called when autosaving pre-existing post
    1919function autosave_saved(response) {
     20        var oldMessage = jQuery('#autosave').html();
    2021        var res = wpAjax.parseAjaxResponse(response, 'autosave'); // parse the ajax response
    2122        var message = '';
    … …  
    3940        }
    4041        if ( message ) { jQuery('#autosave').html(message); } // update autosave message
     42        else if ( oldMessage && res ) { jQuery('#autosave').html( oldMessage ); }
    4143        autosave_enable_buttons(); // re-enable disabled form buttons
    4244        return res;
Note: See TracChangeset for help on using the changeset viewer.