WordPress.org

Make WordPress Core

Ticket #10917: 10917.2.patch

File 10917.2.patch, 3.9 KB (added by ocean90, 8 years ago)

This will remove the 'View all' button after saving as draft too.

  • wp-admin/includes/dashboard.php

     
    384384}
    385385
    386386function wp_dashboard_quick_press() {
     387        global $post_ID;
     388
    387389        $drafts = false;
    388390        if ( 'post' === strtolower( $_SERVER['REQUEST_METHOD'] ) && isset( $_POST['action'] ) && 0 === strpos( $_POST['action'], 'post-quickpress' ) && (int) $_POST['post_ID'] ) {
    389391                $view = get_permalink( $_POST['post_ID'] );
    390392                $edit = esc_url( get_edit_post_link( $_POST['post_ID'] ) );
    391393                if ( 'post-quickpress-publish' == $_POST['action'] ) {
    392394                        if ( current_user_can('publish_posts') )
    393                                 printf( '<div class="message"><p>' . __( 'Post Published. <a href="%s">View post</a> | <a href="%s">Edit post</a>' ) . '</p></div>', esc_url( $view ), $edit );
     395                                printf( '<div class="updated"><p>' . __( 'Post published. <a href="%s">View post</a> | <a href="%s">Edit post</a>' ) . '</p></div>', esc_url( $view ), $edit );
    394396                        else
    395                                 printf( '<div class="message"><p>' . __( 'Post submitted. <a href="%s">Preview post</a> | <a href="%s">Edit post</a>' ) . '</p></div>', esc_url( add_query_arg( 'preview', 1, $view ) ), $edit );
     397                                printf( '<div class="updated"><p>' . __( 'Post submitted. <a href="%s">Preview post</a> | <a href="%s">Edit post</a>' ) . '</p></div>', esc_url( add_query_arg( 'preview', 1, $view ) ), $edit );
    396398                } else {
    397                         printf( '<div class="message"><p>' . __( 'Draft Saved. <a href="%s">Preview post</a> | <a href="%s">Edit post</a>' ) . '</p></div>', esc_url( add_query_arg( 'preview', 1, $view ) ), $edit );
     399                        printf( '<div class="updated"><p>' . __( 'Draft saved. <a href="%s">Preview post</a> | <a href="%s">Edit post</a>' ) . '</p></div>', esc_url( add_query_arg( 'preview', 1, $view ) ), $edit );
    398400                        $drafts_query = new WP_Query( array(
    399401                                'post_type' => 'post',
    400402                                'post_status' => 'draft',
     
    407409                        if ( $drafts_query->posts )
    408410                                $drafts =& $drafts_query->posts;
    409411                }
    410                 printf('<p class="textright">' . __('You can also try %s, easy blogging from anywhere on the Web.') . '</p>', '<a href="tools.php">' . __('Press This') . '</a>' );
     412                printf('<p class="textright">' . __('You can also try %s, easy blogging from anywhere on the Web.') . '</p>', '<a href="' . esc_url( admin_url( 'tools.php' ) ) . '">' . __('Press This') . '</a>' );
    411413                $_REQUEST = array(); // hack for get_default_post_to_edit()
    412414        }
    413415
    414         $post = get_default_post_to_edit();
     416        $post = get_default_post_to_edit('post', true);
     417        $post_ID = (int) $post->ID;
    415418?>
    416419
    417420        <form name="post" action="<?php echo esc_url( admin_url( 'post.php' ) ); ?>" method="post" id="quick-press">
     
    440443
    441444                <p class="submit">
    442445                        <input type="hidden" name="action" id="quickpost-action" value="post-quickpress-save" />
    443                         <input type="hidden" name="quickpress_post_ID" value="<?php echo (int) $post->ID; ?>" />
     446                        <input type="hidden" name="quickpress_post_ID" value="<?php echo $post_ID; ?>" />
    444447                        <input type="hidden" name="post_type" value="post" />
    445448                        <?php wp_nonce_field('add-post'); ?>
    446449                        <input type="submit" name="save" id="save-post" class="button" tabindex="4" value="<?php esc_attr_e('Save Draft'); ?>" />
  • wp-admin/js/dashboard.dev.js

     
    5353                        $('#dashboard_quick_press div.inside').load( t.attr( 'action' ), t.serializeArray(), function() {
    5454                                $('#dashboard_quick_press #publishing-action img.waiting').css('visibility', 'hidden');
    5555                                $('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').attr('disabled','');
     56                                $('#dashboard_quick_press ul').next('p').remove();
    5657                                $('#dashboard_quick_press ul').find('li').each( function() {
    5758                                        $('#dashboard_recent_drafts ul').prepend( this );
    5859                                } ).end().remove();