Fix edit comment links
git-svn-id: http://svn.automattic.com/wordpress/trunk@5340 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
72f35d050c
commit
e5ea802c0c
|
@ -277,9 +277,9 @@ function get_post_comments_feed_link($post_id = '', $feed = 'rss2') {
|
||||||
function get_edit_post_link( $id = 0 ) {
|
function get_edit_post_link( $id = 0 ) {
|
||||||
$post = &get_post( $id );
|
$post = &get_post( $id );
|
||||||
|
|
||||||
if ( $post->post_type == 'attachment' )
|
if ( $post->post_type == 'attachment' ) {
|
||||||
return;
|
return;
|
||||||
elseif ( $post->post_type == 'page' ) {
|
} elseif ( $post->post_type == 'page' ) {
|
||||||
if ( !current_user_can( 'edit_page', $post->ID ) )
|
if ( !current_user_can( 'edit_page', $post->ID ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -297,9 +297,9 @@ function get_edit_post_link( $id = 0 ) {
|
||||||
function edit_post_link( $link = 'Edit This', $before = '', $after = '' ) {
|
function edit_post_link( $link = 'Edit This', $before = '', $after = '' ) {
|
||||||
global $post;
|
global $post;
|
||||||
|
|
||||||
if ( $post->post_type == 'attachment' )
|
if ( $post->post_type == 'attachment' ) {
|
||||||
return;
|
return;
|
||||||
elseif ( $post->post_type == 'page' ) {
|
} elseif ( $post->post_type == 'page' ) {
|
||||||
if ( !current_user_can( 'edit_page', $post->ID ) )
|
if ( !current_user_can( 'edit_page', $post->ID ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -319,14 +319,15 @@ function get_edit_comment_link( $comment_id = 0 ) {
|
||||||
$comment = &get_comment( $comment_id );
|
$comment = &get_comment( $comment_id );
|
||||||
$post = &get_post( $comment->comment_post_ID );
|
$post = &get_post( $comment->comment_post_ID );
|
||||||
|
|
||||||
if ( $post->post_type == 'attachment' )
|
if ( $post->post_type == 'attachment' ) {
|
||||||
return;
|
return;
|
||||||
elseif ( $post->post_type == 'page' )
|
} elseif ( $post->post_type == 'page' ) {
|
||||||
if ( !current_user_can( 'edit_page', $post->ID ) )
|
if ( !current_user_can( 'edit_page', $post->ID ) )
|
||||||
return;
|
return;
|
||||||
else
|
} else {
|
||||||
if ( !current_user_can( 'edit_post', $post->ID ) )
|
if ( !current_user_can( 'edit_post', $post->ID ) )
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$location = get_bloginfo( 'wpurl' ) . '/wp-admin/comment.php?action=editcomment&c=' . $comment->comment_ID;
|
$location = get_bloginfo( 'wpurl' ) . '/wp-admin/comment.php?action=editcomment&c=' . $comment->comment_ID;
|
||||||
return apply_filters( 'get_edit_comment_link', $location );
|
return apply_filters( 'get_edit_comment_link', $location );
|
||||||
|
@ -335,14 +336,15 @@ function get_edit_comment_link( $comment_id = 0 ) {
|
||||||
function edit_comment_link( $link = 'Edit This', $before = '', $after = '' ) {
|
function edit_comment_link( $link = 'Edit This', $before = '', $after = '' ) {
|
||||||
global $comment, $post;
|
global $comment, $post;
|
||||||
|
|
||||||
if ( $post->post_type == 'attachment' )
|
if ( $post->post_type == 'attachment' ) {
|
||||||
return;
|
return;
|
||||||
elseif ( $post->post_type == 'page' )
|
} elseif ( $post->post_type == 'page' ) {
|
||||||
if ( !current_user_can( 'edit_page', $post->ID ) )
|
if ( !current_user_can( 'edit_page', $post->ID ) )
|
||||||
return;
|
return;
|
||||||
else
|
} else {
|
||||||
if ( !current_user_can( 'edit_post', $post->ID ) )
|
if ( !current_user_can( 'edit_post', $post->ID ) )
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$link = '<a href="' . get_edit_comment_link( $comment->comment_ID ) . '" title="' . __( 'Edit comment' ) . '">' . $link . '</a>';
|
$link = '<a href="' . get_edit_comment_link( $comment->comment_ID ) . '" title="' . __( 'Edit comment' ) . '">' . $link . '</a>';
|
||||||
echo $before . apply_filters( 'edit_comment_link', $link, $comment->comment_ID ) . $after;
|
echo $before . apply_filters( 'edit_comment_link', $link, $comment->comment_ID ) . $after;
|
||||||
|
|
Loading…
Reference in New Issue