mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-12 21:00:21 +00:00
Post revisions from mdawaffe. see #6775
git-svn-id: https://develop.svn.wordpress.org/trunk@7747 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -442,10 +442,15 @@ function get_search_comments_feed_link($search_query = '', $feed = '') {
|
||||
return $link;
|
||||
}
|
||||
|
||||
function get_edit_post_link( $id = 0 ) {
|
||||
function get_edit_post_link( $id = 0, $context = 'display' ) {
|
||||
if ( !$post = &get_post( $id ) )
|
||||
return;
|
||||
|
||||
if ( 'display' == $context )
|
||||
$action = 'action=edit&';
|
||||
else
|
||||
$action = 'action=edit&';
|
||||
|
||||
switch ( $post->post_type ) :
|
||||
case 'page' :
|
||||
if ( !current_user_can( 'edit_page', $post->ID ) )
|
||||
@@ -459,6 +464,13 @@ function get_edit_post_link( $id = 0 ) {
|
||||
$file = 'media';
|
||||
$var = 'attachment_id';
|
||||
break;
|
||||
case 'revision' :
|
||||
if ( !current_user_can( 'edit_post', $post->ID ) )
|
||||
return;
|
||||
$file = 'revision';
|
||||
$var = 'revision';
|
||||
$action = '';
|
||||
break;
|
||||
default :
|
||||
if ( !current_user_can( 'edit_post', $post->ID ) )
|
||||
return;
|
||||
@@ -467,7 +479,7 @@ function get_edit_post_link( $id = 0 ) {
|
||||
break;
|
||||
endswitch;
|
||||
|
||||
return apply_filters( 'get_edit_post_link', get_bloginfo( 'wpurl' ) . "/wp-admin/$file.php?action=edit&$var=$post->ID", $post->ID );
|
||||
return apply_filters( 'get_edit_post_link', get_bloginfo( 'wpurl' ) . "/wp-admin/$file.php?{$action}$var=$post->ID", $post->ID );
|
||||
}
|
||||
|
||||
function edit_post_link( $link = 'Edit This', $before = '', $after = '' ) {
|
||||
|
||||
Reference in New Issue
Block a user