WordPress.org

Make WordPress Core

Ticket #6043: 6043.3.diff

File 6043.3.diff, 5.3 KB (added by mdawaffe, 6 years ago)
  • wp-includes/js/autosave.js

     
    11var autosaveLast = ''; 
    22var autosavePeriodical; 
     3var autosaveOldMessage = ''; 
    34 
    45jQuery(function($) { 
    56        autosaveLast = $('#post #title').val()+$('#post #content').val(); 
     
    1718 
    1819// called when autosaving pre-existing post 
    1920function autosave_saved(response) { 
    20         var oldMessage = jQuery('#autosave').html(); 
    2121        var res = wpAjax.parseAjaxResponse(response, 'autosave'); // parse the ajax response 
    2222        var message = ''; 
    2323 
     
    3939                } 
    4040        } 
    4141        if ( message ) { jQuery('#autosave').html(message); } // update autosave message 
    42         else if ( oldMessage && res ) { jQuery('#autosave').html( oldMessage ); } 
     42        else if ( autosaveOldMessage && res ) { jQuery('#autosave').html( autosaveOldMessage ); } 
    4343        autosave_enable_buttons(); // re-enable disabled form buttons 
    4444        return res; 
    4545} 
     
    180180                post_data['autosave'] = 0; 
    181181        } 
    182182 
     183        autosaveOldMessage = jQuery('#autosave').html(); 
     184 
    183185        jQuery.ajax({ 
    184186                data: post_data, 
    185187                beforeSend: doAutoSave ? autosave_loading : null, 
  • wp-admin/admin-ajax.php

     
    472472        check_ajax_referer( 'autosave', 'autosavenonce' ); 
    473473        global $current_user; 
    474474 
    475         $_POST['post_content'] = $_POST['content']; 
    476         $_POST['post_excerpt'] = $_POST['excerpt']; 
    477475        $_POST['post_status'] = 'draft'; 
    478476        $_POST['post_category'] = explode(",", $_POST['catslist']); 
    479477        $_POST['tags_input'] = explode(",", $_POST['tags_input']); 
     
    521519                                die(__('You are not allowed to edit this post.')); 
    522520                } 
    523521                if ( $do_autosave ) { 
    524                         $id = wp_update_post($_POST); 
     522                        $id = edit_post(); 
    525523                        $data = $message; 
    526524                } else { 
    527525                        $id = $post->ID; 
  • wp-admin/wp-admin.css

     
    12151215        border-bottom: 1px solid #ccc; 
    12161216} 
    12171217 
     1218.submitbox #autosave .error { 
     1219        color: #333; 
     1220} 
     1221 
    12181222/* Categories */ 
    12191223 
    12201224#categorydiv #category-adder { 
  • wp-admin/includes/post.php

     
    113113        // Now that we have an ID we can fix any attachment anchor hrefs 
    114114        _fix_attachment_links( $post_ID ); 
    115115 
     116        wp_set_post_lock( $post_ID, $GLOBALS['current_user']->ID ); 
     117 
    116118        return $post_ID; 
    117119} 
    118120 
     
    321323        // Now that we have an ID we can fix any attachment anchor hrefs 
    322324        _fix_attachment_links( $post_ID ); 
    323325 
     326        wp_set_post_lock( $post_ID, $GLOBALS['current_user']->ID ); 
     327 
    324328        return $post_ID; 
    325329} 
    326330 
  • wp-admin/post.php

     
    6969        if ( $last = wp_check_post_lock( $post->ID ) ) { 
    7070                $last_user = get_userdata( $last ); 
    7171                $last_user_name = $last_user ? $last_user->display_name : __('Somebody'); 
    72                 $message = sprintf( __( '%s is currently editing this post' ), wp_specialchars( $last_user_name ) ); 
     72                $message = sprintf( __( 'Warning: %s is currently editing this post' ), wp_specialchars( $last_user_name ) ); 
    7373                $message = str_replace( "'", "\'", "<div class='error'><p>$message</p></div>" ); 
    7474                add_action('admin_notices', create_function( '', "echo '$message';" ) ); 
    7575        } else { 
  • wp-admin/edit-page-form.php

     
    129129<br class="clear" /> 
    130130<?php if ($post_ID): ?> 
    131131<?php printf(__('Last edited on %1$s at %2$s'), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified)); ?> 
     132<br class="clear" /> 
    132133<?php endif; ?> 
    133134<span id="autosave"></span> 
    134135</p> 
  • wp-admin/edit-form-advanced.php

     
    151151<br class="clear" /> 
    152152<?php if ($post_ID): ?> 
    153153<?php printf(__('Last edited on %1$s at %2$s'), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified)); ?> 
     154<br class="clear" /> 
    154155<?php endif; ?> 
    155156<span id="autosave"></span> 
    156157</p> 
  • wp-admin/page.php

     
    6060        if ( $last = wp_check_post_lock( $post->ID ) ) { 
    6161                $last_user = get_userdata( $last ); 
    6262                $last_user_name = $last_user ? $last_user->display_name : __('Somebody'); 
    63                 $message = sprintf( __( '%s is currently editing this page' ), wp_specialchars( $last_user_name ) ); 
     63                $message = sprintf( __( 'Warning: %s is currently editing this page' ), wp_specialchars( $last_user_name ) ); 
    6464                $message = str_replace( "'", "\'", "<div class='error'><p>$message</p></div>" ); 
    6565                add_action('admin_notices', create_function( '', "echo '$message';" ) ); 
    6666        } else {