Fix edit links.
git-svn-id: https://develop.svn.wordpress.org/trunk@3567 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
cd4a8a24c5
commit
bc8f242382
@ -208,13 +208,18 @@ function get_feed_link($feed='rss2') {
|
||||
function edit_post_link($link = 'Edit This', $before = '', $after = '') {
|
||||
global $post;
|
||||
|
||||
if ( ! current_user_can('edit_post', $post->ID) )
|
||||
return;
|
||||
|
||||
if ( is_attachment() )
|
||||
return;
|
||||
else
|
||||
|
||||
if( $post->post_type == 'page' ) {
|
||||
if ( ! current_user_can('edit_page', $post->ID) )
|
||||
return;
|
||||
$file = 'page';
|
||||
} else {
|
||||
if ( ! current_user_can('edit_post', $post->ID) )
|
||||
return;
|
||||
$file = 'post';
|
||||
}
|
||||
|
||||
$location = get_settings('siteurl') . "/wp-admin/{$file}.php?action=edit&post=$post->ID";
|
||||
echo $before . "<a href=\"$location\">$link</a>" . $after;
|
||||
@ -223,10 +228,14 @@ function edit_post_link($link = 'Edit This', $before = '', $after = '') {
|
||||
function edit_comment_link($link = 'Edit This', $before = '', $after = '') {
|
||||
global $post, $comment;
|
||||
|
||||
if ( ! current_user_can('edit_post', $post->ID) )
|
||||
return;
|
||||
if( $post->post_type == 'page' )
|
||||
if ( ! current_user_can('edit_page', $post->ID) )
|
||||
return;
|
||||
else
|
||||
if ( ! current_user_can('edit_post', $post->ID) )
|
||||
return;
|
||||
|
||||
$location = get_settings('siteurl') . "/wp-admin/post.php?action=editcomment&comment=$comment->comment_ID";
|
||||
$location = get_settings('siteurl') . "/wp-admin/comment.php?action=editcomment&comment=$comment->comment_ID";
|
||||
echo $before . "<a href='$location'>$link</a>" . $after;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user