mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-16 14:50:29 +00:00
Embeds. Props Viper007Bond. see #10337
git-svn-id: https://develop.svn.wordpress.org/trunk@12023 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -959,6 +959,30 @@ function current_user_can( $capability ) {
|
||||
return call_user_func_array( array( &$current_user, 'has_cap' ), $args );
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether author of supplied post has capability or role.
|
||||
*
|
||||
* @since 2.9
|
||||
*
|
||||
* @param int|object $post Post ID or post object.
|
||||
* @param string $capability Capability or role name.
|
||||
* @return bool
|
||||
*/
|
||||
function author_can( $post, $capability ) {
|
||||
if ( !$post = get_post($post) )
|
||||
return false;
|
||||
|
||||
$author = new WP_User( $post->post_author );
|
||||
|
||||
if ( empty( $author ) )
|
||||
return false;
|
||||
|
||||
$args = array_slice( func_get_args(), 2 );
|
||||
$args = array_merge( array( $capability ), $args );
|
||||
|
||||
return call_user_func_array( array( &$author, 'has_cap' ), $args );
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve role object.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user