WordPress.org

Make WordPress Core

Changeset 12783


Ignore:
Timestamp:
01/21/2010 06:53:33 AM (11 years ago)
Author:
ryan
Message:

Update trash and right now links for pages. fixes #11958

Location:
trunk
Files:
6 edited

Legend:

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

    r12728 r12783  
    4141<?php
    4242
    43 if ( in_array( $pagenow, array('post.php', 'post-new.php', 'page.php') ) ) {
     43if ( in_array( $pagenow, array('post.php', 'post-new.php') ) ) {
    4444    add_action( 'admin_print_footer_scripts', 'wp_tiny_mce', 25 );
    4545    wp_enqueue_script('quicktags');
  • trunk/wp-admin/edit.php

    r12728 r12783  
    6666        $doaction = ($_GET['action'] != -1) ? $_GET['action'] : $_GET['action2'];
    6767    } else {
    68         wp_redirect( admin_url('edit.php') );
     68        wp_redirect( admin_url("edit.php?post_type=$post_type") );
    6969    }
    7070
     
    128128
    129129    if ( isset($_GET['action']) )
    130         $sendback = remove_query_arg( array('action', 'action2', 'cat', 'tags_input', 'post_author', 'comment_status', 'ping_status', '_status',  'post', 'bulk_edit', 'post_view', 'post_type'), $sendback );
     130        $sendback = remove_query_arg( array('action', 'action2', 'cat', 'tags_input', 'post_author', 'comment_status', 'ping_status', '_status',  'post', 'bulk_edit', 'post_view'), $sendback );
    131131
    132132    wp_redirect($sendback);
     
    199199    printf( _n( 'Item moved to the trash.', '%s items moved to the trash.', $_GET['trashed'] ), number_format_i18n( $_GET['trashed'] ) );
    200200    $ids = isset($_GET['ids']) ? $_GET['ids'] : 0;
    201     echo ' <a href="' . esc_url( wp_nonce_url( "edit.php?doaction=undo&action=untrash&ids=$ids", "bulk-posts" ) ) . '">' . __('Undo') . '</a><br />';
     201    echo ' <a href="' . esc_url( wp_nonce_url( "edit.php?post_type=$post_type&doaction=undo&action=untrash&ids=$ids", "bulk-posts" ) ) . '">' . __('Undo') . '</a><br />';
    202202    unset($_GET['trashed']);
    203203}
  • trunk/wp-admin/includes/dashboard.php

    r12765 r12783  
    253253    $text = _n( 'Page', 'Pages', $num_pages->publish );
    254254    if ( current_user_can( 'edit_pages' ) ) {
    255         $num = "<a href='edit-pages.php'>$num</a>";
    256         $text = "<a href='edit-pages.php'>$text</a>";
     255        $num = "<a href='edit.php?post_type=page'>$num</a>";
     256        $text = "<a href='edit.php?post_type=page'>$text</a>";
    257257    }
    258258    echo '<td class="first b b_pages">' . $num . '</td>';
  • trunk/wp-admin/includes/template.php

    r12781 r12783  
    16061606    $hidden = get_hidden_columns(  $current_screen );
    16071607    $title = _draft_or_post_title();
     1608    $post_type = $page->post_type;
    16081609?>
    16091610<tr id="page-<?php echo $id; ?>" class="<?php echo $rowclass; ?> iedit">
     
    16701671        if ( current_user_can('delete_page', $page->ID) ) {
    16711672            if ( $post->post_status == 'trash' )
    1672                 $actions['untrash'] = "<a title='" . esc_attr(__('Remove this page from the Trash')) . "' href='" . wp_nonce_url("page.php?action=untrash&amp;post=$page->ID", 'untrash-page_' . $page->ID) . "'>" . __('Restore') . "</a>";
     1673                $actions['untrash'] = "<a title='" . esc_attr(__('Remove this page from the Trash')) . "' href='" . wp_nonce_url("post.php?post_type=$post_type&amp;action=untrash&amp;post=$page->ID", 'untrash-page_' . $page->ID) . "'>" . __('Restore') . "</a>";
    16731674            elseif ( EMPTY_TRASH_DAYS )
    16741675                $actions['trash'] = "<a class='submitdelete' title='" . esc_attr(__('Move this page to the Trash')) . "' href='" . get_delete_post_link($page->ID) . "'>" . __('Trash') . "</a>";
    16751676            if ( $post->post_status == 'trash' || !EMPTY_TRASH_DAYS )
    1676                 $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this page permanently')) . "' href='" . wp_nonce_url("page.php?action=delete&amp;post=$page->ID", 'delete-page_' . $page->ID) . "'>" . __('Delete Permanently') . "</a>";
     1677                $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this page permanently')) . "' href='" . wp_nonce_url("post.php?post_type=$post_type&amp;action=delete&amp;post=$page->ID", 'delete-page_' . $page->ID) . "'>" . __('Delete Permanently') . "</a>";
    16771678        }
    16781679        if ( in_array($post->post_status, array('pending', 'draft')) ) {
  • trunk/wp-includes/link-template.php

    r12733 r12783  
    738738        $action = 'action=trash&';
    739739
    740     switch ( $post->post_type ) :
    741     case 'page' :
    742         if ( !current_user_can( 'delete_page', $post->ID ) )
    743             return;
    744         $file = 'page';
    745         $var  = 'post';
    746         break;
    747     case 'attachment' :
    748         if ( !current_user_can( 'delete_post', $post->ID ) )
    749             return;
    750         $file = 'media';
    751         $var  = 'attachment_id';
    752         break;
    753     case 'revision' :
    754         if ( !current_user_can( 'delete_post', $post->ID ) )
    755             return;
    756         $file = 'revision';
    757         $var  = 'revision';
    758         $action = '';
    759         break;
    760     default :
    761         if ( !current_user_can( 'edit_post', $post->ID ) )
    762             return apply_filters( 'get_delete_post_link', '', $post->ID, $context );
    763         $file = 'post';
    764         $var  = 'post';
    765         break;
    766     endswitch;
    767 
    768     return apply_filters( 'get_delete_post_link', wp_nonce_url( admin_url("$file.php?{$action}$var=$post->ID"), "trash-{$file}_" . $post->ID ), $context );
     740    if ( 'display' == $context )
     741        $action = '&amp;action=trash';
     742    else
     743        $action = '&action=trash';
     744
     745    $post_type_object = get_post_type_object( $post->post_type );
     746    if ( !$post_type_object )
     747        return;
     748
     749    if ( !current_user_can( $post_type_object->delete_cap, $post->ID ) )
     750        return;
     751
     752    return apply_filters( 'get_delete_post_link', wp_nonce_url( admin_url( sprintf($post_type_object->_edit_link . $action, $post->ID) ),  "trash-{$post->post_type}_" . $post->ID), $post->ID, $context );
    769753}
    770754
  • trunk/wp-includes/post.php

    r12768 r12783  
    721721        $args->edit_cap = '';
    722722        $args->read_cap = '';
     723        $args->delete_cap = '';
    723724    } else {
    724725        $args->edit_cap = 'edit_' . $args->capability_type;
    725726        $args->read_cap = 'read_' . $args->capability_type;
     727        $args->delete_cap = 'delete_' . $args->capability_type;
    726728    }
    727729
Note: See TracChangeset for help on using the changeset viewer.