mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
Introduce 'edit_comment' meta cap. Fixes #14520
git-svn-id: https://develop.svn.wordpress.org/trunk@15596 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -896,6 +896,7 @@ function map_meta_cap( $cap, $user_id ) {
|
||||
$author_data = get_userdata( $user_id );
|
||||
//echo "post ID: {$args[0]}<br />";
|
||||
$post = get_post( $args[0] );
|
||||
|
||||
$post_type = get_post_type_object( $post->post_type );
|
||||
if ( $post_type && 'post' != $post_type->capability_type ) {
|
||||
$args = array_merge( array( $post_type->cap->edit_post, $user_id ), $args );
|
||||
@@ -988,6 +989,13 @@ function map_meta_cap( $cap, $user_id ) {
|
||||
else
|
||||
$caps[] = 'read_private_pages';
|
||||
break;
|
||||
case 'edit_comment':
|
||||
$comment = get_comment( $args[0] );
|
||||
$post = get_post( $comment->comment_post_ID );
|
||||
$post_type_object = get_post_type_object( $post->post_type );
|
||||
|
||||
$caps = map_meta_cap( $post_type_object->cap->edit_post, $user_id, $post->ID );
|
||||
break;
|
||||
case 'unfiltered_upload':
|
||||
if ( defined('ALLOW_UNFILTERED_UPLOADS') && ALLOW_UNFILTERED_UPLOADS && ( !is_multisite() || is_super_admin( $user_id ) ) )
|
||||
$caps[] = $cap;
|
||||
|
||||
Reference in New Issue
Block a user