user_can [ WordPress Function ]
user_can ( $user, $capability )
| Parameters: |
|
| Returns: |
|
| Defined at: |
|
Soorgelijke functies: author_can, is_user_admin, current_user_can, user_admin_url, user_can_richedit
Whether a particular user has capability or role.
Source
<?php
function user_can( $user, $capability ) {
if ( ! is_object( $user ) )
$user = new WP_User( $user );
if ( ! $user || ! $user->exists() )
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 );
}
?>
Examples [ wp-snippets.com ]
Top Google zoekresultaten
- Function Reference/user can « WordPress Codex
Description. Whether a user has capability or role. Similar to current_user_can(), but this function takes a user ID or object as its first parameter.
codex.wordpress.org - Function Reference/current user can « WordPress Codex
Description. Whether the current user has a certain capability or role. See: Roles and Capabilities. It will only return true if a logged in user's role or capability ...
codex.wordpress.org - user roles - user_can() not working for comment authors - WordPress
Jul 12, 2011 ... I'm trying to do some capability checks on comment authors using the user_can() function, but for some reason it isn't working at all. I have a ...
wordpress.stackexchange.com - Issue #14: "no key" when using user_can? · kristianmandrup - GitHub
Nov 22, 2011 ... After some debug, what I've found is that it's trying to invalidate session[: permission], though the :permission key is not set session. The trace: ...
github.com