You are here

public function Instagram::user_recent in Drupagram 6

Same name and namespace in other branches
  1. 7 drupagram.lib.php \Instagram::user_recent()

Get the most recent media published by a user. GET /users/{user-id}/media/recent

PARAMETERS access_token A valid access token. max_id Return media earlier than this max_id min_id Return media later than this min_id count Count of media to return min_timestamp Return media after this UNIX timestamp max_timestamp Return media before this UNIX timestamp

File

./drupagram.lib.php, line 271
Classes to implement the full Instagram API

Class

Instagram
Primary Instagram API implementation class Supports the full REST API for drupagram.

Code

public function user_recent($id = NULL, $params = array(), $use_auth = TRUE) {
  if (empty($id)) {
    $params['!user_id'] = 'self';
  }
  elseif (is_numeric($id)) {
    $params['!user_id'] = $id;
  }
  else {
    $username = $id;

    // $params['username'] = $username;
    $account = $this
      ->user_lookup($username);
    $params['!user_id'] = $account->id;
  }
  return $this
    ->fetch('user_recent', $params, $use_auth);
}