Ticket #14520: edit_comment.diff
File edit_comment.diff, 2.8 KB (added by , 13 years ago) |
---|
-
wp-includes/link-template.php
874 874 * @return string 875 875 */ 876 876 function get_edit_comment_link( $comment_id = 0 ) { 877 $comment = &get_comment( $comment_id );878 $post = &get_post( $comment->comment_post_ID );877 if ( !current_user_can('edit_comment', $comment_id) ) 878 return; 879 879 880 if ( $post->post_type == 'page' ) { 881 if ( !current_user_can( 'edit_page', $post->ID ) ) 882 return; 883 } else { 884 if ( !current_user_can( 'edit_post', $post->ID ) ) 885 return; 886 } 887 888 $location = admin_url('comment.php?action=editcomment&c=') . $comment->comment_ID; 880 $location = admin_url('comment.php?action=editcomment&c=') . $comment_id; 889 881 return apply_filters( 'get_edit_comment_link', $location ); 890 882 } 891 883 … … 900 892 * @return string|null HTML content, if $echo is set to false. 901 893 */ 902 894 function edit_comment_link( $link = null, $before = '', $after = '' ) { 903 global $comment , $post;895 global $comment; 904 896 905 if ( $post->post_type == 'page' ) { 906 if ( !current_user_can( 'edit_page', $post->ID ) ) 907 return; 908 } else { 909 if ( !current_user_can( 'edit_post', $post->ID ) ) 910 return; 911 } 897 if ( !current_user_can('edit_comment', $comment->comment_ID) ) 898 return; 912 899 913 900 if ( null === $link ) 914 901 $link = __('Edit This'); -
wp-includes/capabilities.php
990 990 else 991 991 $caps[] = 'read_private_pages'; 992 992 break; 993 case 'edit_comment': 994 $caps[] = 'edit_published_posts'; 995 996 $comment = get_comment( $args[0] ); 997 998 if ( $comment->user_id != $user_id ) 999 $caps[] = 'moderate_comments'; 1000 break; 993 1001 case 'unfiltered_upload': 994 1002 if ( defined('ALLOW_UNFILTERED_UPLOADS') && ALLOW_UNFILTERED_UPLOADS && ( !is_multisite() || is_super_admin( $user_id ) ) ) 995 1003 $caps[] = $cap; -
wp-admin/comment.php
60 60 if ( !$comment = get_comment( $comment_id ) ) 61 61 comment_footer_die( __('Oops, no comment with this ID.') . sprintf(' <a href="%s">'.__('Go back').'</a>!', 'javascript:history.go(-1)') ); 62 62 63 if ( !current_user_can('edit_ post', $comment->comment_post_ID) )64 comment_footer_die( __('You are not allowed to edit comments on this post.') );63 if ( !current_user_can('edit_comment', $comment_id) ) 64 comment_footer_die( __('You are not allowed to edit this comment.') ); 65 65 66 66 if ( 'trash' == $comment->comment_approved ) 67 67 comment_footer_die( __('This comment is in the Trash. Please move it out of the Trash if you want to edit it.') );