[wp-trac] [WordPress Trac] #5811: wp-admin/edit-comments.php unnecessarily checks twice for user permissions

WordPress Trac wp-trac at lists.automattic.com
Sun Feb 10 04:07:18 GMT 2008


#5811: wp-admin/edit-comments.php unnecessarily checks twice for user permissions
----------------------------+-----------------------------------------------
 Reporter:  hansengel       |       Owner:  hansengel       
     Type:  defect          |      Status:  new             
 Priority:  normal          |   Milestone:  2.5             
Component:  Administration  |     Version:  2.5             
 Severity:  minor           |    Keywords:  has-patch tested
----------------------------+-----------------------------------------------
 It's easier to just show you the current code (as of [6772]):
 {{{
     <td><?php if ( current_user_can('edit_post',
 $comment->comment_post_ID) ) {
         echo "<a
 href='comment.php?action=editcomment&amp;c=$comment->comment_ID'
 class='edit'>" .  __('Edit') . "</a>"; } ?></td>
     <td><?php if ( current_user_can('edit_post',
 $comment->comment_post_ID) ) {
                 $url = clean_url( wp_nonce_url(
 "comment.php?action=deletecomment&p=$comment->comment_post_ID&c=$comment->comment_ID",
 "delete-comment_$comment->comment_ID" ) );
                 echo "<a href='$url' class='delete:the-comment-
 list:comment-$comment->comment_ID delete'>" . __('Delete') . "</a> ";
                 } ?></td>
 }}}
 I don't see any point in repeatedly checking if the user has sufficient
 permissions on the same page. Let's simplify it a bit and check for user
 permissions once.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/5811>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list