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;
    }