Definition:
function user_can( $user, $capability ) {}
Whether a particular user has capability or role.
Parameters
- int|object $user: User ID or object.
- string $capability: Capability or role name.
Source code
function user_can( $user, $capability ) {
if ( ! is_object( $user ) )
$user = new WP_User( $user );
if ( ! $user || ! $user->ID )
return false;
$args = array_slice( func_get_args(), 2 );
$args = array_merge( array( $capability ), $args );
return call_user_func_array( array( &$user, 'has_cap' ), $args );
}
10505

February 24, 2011 


No comments yet... Be the first to leave a reply!