You are here

function instagram_feeds_get_instagram_user in Instagram Feeds 7

Get user object from Instagram using username.

Parameters

string $username: Instagram username

Return value

combine FALSE if no users found or user object with user id.

1 call to instagram_feeds_get_instagram_user()
instagram_feeds_taxonomy_term_presave in ./instagram_feeds.module
Implements hook_taxonomy_term_presave().

File

./instagram_feeds.module, line 91

Code

function instagram_feeds_get_instagram_user($username) {
  $user = FALSE;
  $client_id = variable_get('instagram_feeds_client_id', '');

  // Getting response from Instagram server.
  $response = drupal_http_request(INSTAGRAM_FEEDS_BASE_URL . '/users/search?q=' . $username . '&client_id=' . $client_id);
  if ('OK' == $response->status_message && isset($response->data)) {
    $data = drupal_json_decode($response->data);
    $user = (object) $data['data'][0];
  }
  return $user;
}