Codestyle

This commit is contained in:
Jory Hogeveen 2018-10-15 17:21:04 +02:00 committed by GitHub
parent b85c142d97
commit e5f934d0a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 6 deletions

View File

@ -279,7 +279,7 @@ function wc_customer_bought_product( $customer_email, $user_id, $product_id ) {
/**
* Checks if the current user has a role.
*
* @param string $role The role.
* @param string $role The role.
* @return bool
*/
function wc_current_user_has_role( $role ) {
@ -294,13 +294,15 @@ function wc_current_user_has_role( $role ) {
* @return bool
*/
function wc_user_has_role( $user, $role ) {
if ( ! is_object( $user ) )
$user = get_userdata( $user );
if ( ! is_object( $user ) ) {
$user = get_userdata( $user );
}
if ( ! $user || ! $user->exists() )
return false;
if ( ! $user || ! $user->exists() ) {
return false;
}
return in_array( $role, $user->roles, true );
return in_array( $role, $user->roles, true );
}
/**