mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
Comments: Use post_password_required() for comment capability checks.
Follow-up to [56836], [57123]. Fixes #59929. git-svn-id: https://develop.svn.wordpress.org/trunk@57285 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
ba40e28093
commit
56e16bda31
@ -648,7 +648,7 @@ class WP_Comments_List_Table extends WP_List_Table {
|
||||
$edit_post_cap = $post ? 'edit_post' : 'edit_posts';
|
||||
|
||||
if ( ! current_user_can( $edit_post_cap, $comment->comment_post_ID )
|
||||
&& ( ! empty( $post->post_password )
|
||||
&& ( post_password_required( $comment->comment_post_ID )
|
||||
|| ! current_user_can( 'read_post', $comment->comment_post_ID ) )
|
||||
) {
|
||||
// The user has no access to the post and thus cannot see the comments.
|
||||
|
||||
@ -832,7 +832,7 @@ class WP_List_Table {
|
||||
$edit_post_cap = $post_object ? 'edit_post' : 'edit_posts';
|
||||
|
||||
if ( ! current_user_can( $edit_post_cap, $post_id )
|
||||
&& ( ! empty( $post_object->post_password )
|
||||
&& ( post_password_required( $post_id )
|
||||
|| ! current_user_can( 'read_post', $post_id ) )
|
||||
) {
|
||||
// The user has no access to the post and thus cannot see the comments.
|
||||
|
||||
@ -1088,10 +1088,8 @@ function wp_dashboard_recent_comments( $total_items = 5 ) {
|
||||
}
|
||||
|
||||
foreach ( $possible as $comment ) {
|
||||
$comment_post = get_post( $comment->comment_post_ID );
|
||||
|
||||
if ( ! current_user_can( 'edit_post', $comment->comment_post_ID )
|
||||
&& ( ! empty( $comment_post->post_password )
|
||||
&& ( post_password_required( $comment->comment_post_ID )
|
||||
|| ! current_user_can( 'read_post', $comment->comment_post_ID ) )
|
||||
) {
|
||||
// The user has no access to the post and thus cannot see the comments.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user