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

git-svn-id: http://svn.automattic.com/wordpress/trunk@12783 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan
2010-01-21 06:53:33 +00:00
parent 74a86506f6
commit decf135295
6 changed files with 23 additions and 36 deletions

View File

@@ -737,35 +737,19 @@ function get_delete_post_link($id = 0, $context = 'display') {
else
$action = 'action=trash&';
switch ( $post->post_type ) :
case 'page' :
if ( !current_user_can( 'delete_page', $post->ID ) )
return;
$file = 'page';
$var = 'post';
break;
case 'attachment' :
if ( !current_user_can( 'delete_post', $post->ID ) )
return;
$file = 'media';
$var = 'attachment_id';
break;
case 'revision' :
if ( !current_user_can( 'delete_post', $post->ID ) )
return;
$file = 'revision';
$var = 'revision';
$action = '';
break;
default :
if ( !current_user_can( 'edit_post', $post->ID ) )
return apply_filters( 'get_delete_post_link', '', $post->ID, $context );
$file = 'post';
$var = 'post';
break;
endswitch;
if ( 'display' == $context )
$action = '&action=trash';
else
$action = '&action=trash';
return apply_filters( 'get_delete_post_link', wp_nonce_url( admin_url("$file.php?{$action}$var=$post->ID"), "trash-{$file}_" . $post->ID ), $context );
$post_type_object = get_post_type_object( $post->post_type );
if ( !$post_type_object )
return;
if ( !current_user_can( $post_type_object->delete_cap, $post->ID ) )
return;
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 );
}
/**