mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
Add read_post meta cap.
git-svn-id: https://develop.svn.wordpress.org/trunk@3297 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -269,6 +269,21 @@ function map_meta_cap($cap, $user_id) {
|
||||
$caps[] = 'edit_published_posts';
|
||||
}
|
||||
break;
|
||||
case 'read_post':
|
||||
$post = get_post($args[0]);
|
||||
|
||||
if ( 'private' != $post->post_status ) {
|
||||
$caps[] = 'read';
|
||||
break;
|
||||
}
|
||||
|
||||
$author_data = get_userdata($user_id);
|
||||
$post_author_data = get_userdata($post->post_author);
|
||||
if ($user_id == $post_author_data->ID)
|
||||
$caps[] = 'read';
|
||||
else
|
||||
$caps[] = 'read_private_posts';
|
||||
break;
|
||||
default:
|
||||
// If no meta caps match, return the original cap.
|
||||
$caps[] = $cap;
|
||||
|
||||
Reference in New Issue
Block a user