/** * Get maximum protection type determined by the user's roles. * * @param WP_User $user * @return string */ public static function getUserRolesMaxProtectionType($user) { $types = array(); if (!empty($user->roles) and is_array($user->roles)) { foreach ($user->roles as $role) { $types[] = RublonRolesProtection::getRoleProtectionType($role); } } return RublonRolesProtection::getMaximumProtectionType($types); }