/**
  * @param string $key
  * @param string $value
  *
  * @return object|false
  */
 protected function get_user_attributes($key, $value)
 {
     $url = $this->api_url(sprintf(self::ENDPOINT_ATTRIBUTES, \Ekko\THEYKEY_API_KEY));
     $response = wp_remote_get(add_query_arg($key, urlencode($value), $url), array('redirection' => 0, 'headers' => array('Accept' => 'application/xml')));
     $dom = \GTO\Framework\Util\XML::parse_xml_to_domdoc($response['body']);
     if ($dom) {
         $attributes = array();
         $xpath = new \DOMXPath($dom);
         foreach ($xpath->query('/attributes/attribute') as $attr) {
             $attributes[$attr->getAttribute('name')] = $attr->getAttribute('value');
         }
         if (count($attributes) > 0) {
             return (object) $attributes;
         }
     }
     return false;
 }
 /**
  * Get a list of GUID from the specified endpoint
  *
  * @param int         $course_id
  * @param string      $endpoint
  * @param string|null $session
  *
  * @return array
  */
 public function get_users($course_id, $endpoint = self::ENDPOINT_ENROLLED, $session = null)
 {
     $params = array('hub' => \Ekko\URI_HUB, 'session' => $session ? $session : $this->get_session(), 'course' => $course_id);
     $response = wp_remote_get(\GTO\Framework\Util\String::vnsprintf($endpoint, $params), array('redirection' => 0, 'headers' => array('Accept' => 'application/xml')));
     $users = array();
     if ($dom = \GTO\Framework\Util\XML::parse_xml_to_domdoc($response['body'])) {
         $xpath = $this->ekko_xpath_parser($dom);
         foreach ($xpath->query('/hub:users/hub:user/@guid') as $guid) {
             $users[] = strtolower($guid->value);
         }
     }
     return $users;
 }