WPDKUser::hasCap PHP 메소드

hasCap() 공개 정적인 메소드

Restutuisce true se l'utente passato negli inputs (o l'utente corrente se non viene passato id utente) possiede un determinato permesso (capability)
public static hasCap ( string $cap, integer $id_user = null ) : boolean
$cap string Capability ID
$id_user integer Optional. User ID or null for get current user ID
리턴 boolean True se l'utente supporta la capability
    public static function hasCap($cap, $id_user = null)
    {
        if (is_null($id_user)) {
            $id_user = get_current_user_id();
        }
        $user = new WP_User($id_user);
        if ($user) {
            return $user->has_cap($cap);
        }
        return false;
    }