WordPress.org

Make WordPress Core

Ticket #38834: 38834.diff

File 38834.diff, 949 bytes (added by MrFlannagan, 3 years ago)

The patch checks if the current date and time is before that of a post then instead of removing the "Schedule" option on an inline post edit in draft mode, it leaves "Schedule" and removes "Publish"

  • wp-admin/js/inline-edit-post.js

    diff --git a/wp-admin/js/inline-edit-post.js b/wp-admin/js/inline-edit-post.js
    index 84ffd78..ab73447 100644
    a b inlineEditPost = { 
    200200                });
    201201
    202202                // handle the post status
     203                var post_date_string = $(':input[name="aa"]').val() + '-' + $(':input[name="mm"]').val() + '-' + $(':input[name="jj"]').val();
     204                post_date_string += ' ' + $(':input[name="hh"]').val() + ':' + $(':input[name="mn"]').val() + ':' + $(':input[name="ss"]').val();
     205                var post_date = new Date( post_date_string );
    203206                status = $('._status', rowData).text();
    204                 if ( 'future' !== status ) {
     207                if ( 'future' !== status && Date($.now()) > post_date ) {
    205208                        $('select[name="_status"] option[value="future"]', editRow).remove();
     209                } else {
     210                        $('select[name="_status"] option[value="publish"]', editRow).remove();
    206211                }
    207212
    208213                pw = $( '.inline-edit-password-input' ).prop( 'disabled', false );