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:
Ryan Boren
2009-10-13 17:04:22 +00:00
parent 9d5f38a1df
commit e71f15a979
11 changed files with 775 additions and 4 deletions
+24
View File
@@ -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.
*