You are here

function drupagram_account_load in Drupagram 7

Same name and namespace in other branches
  1. 6 drupagram.inc \drupagram_account_load()

Load a Instagram account from {drupagram_account}.

Parameters

$id: Instagram UID

Return value

object The appropriate InstagramUser object.

7 calls to drupagram_account_load()
drupagram_account_delete in ./drupagram.inc
Delete a drupagram account and its statuses.
drupagram_actions_set_status in drupagram_actions/drupagram_actions.rules.inc
Fetches drupagram account info and submits with the message to the drupagram API
drupagram_actions_set_status_action in drupagram_actions/drupagram_actions.module
Implementation of a configurable Instagram actions. @todo Implementation for language negotiation for the body and sumary. Also need implementation for bodies with multiple values. Right now it is hard coded and it will only get body and summary for…
drupagram_drupagram_accounts in ./drupagram.module
Implements hook_drupagram_accounts(). We want to move this into a separate module eventually, but sticking the code here and using a hook lets other modules solve the 'what accounts can a user post with' problem in cleaner ways.
drupagram_fetch_recent_items in ./drupagram.inc
Fetches a user's recent items.

... See full list

File

./drupagram.inc, line 82
Instagram API functions

Code

function drupagram_account_load($id) {
  $accounts =& drupal_static(__FUNCTION__);
  if (!isset($accounts[$id])) {
    $all_accounts = drupagram_account_load_all();
    if (isset($all_accounts[$id])) {
      $values = (array) $all_accounts[$id];
      $values['id'] = $values['drupagram_id'];
      $account = new InstagramUser($values);
      $account
        ->set_auth($values);
      $account->uid = $values['uid'];
      $account->import = $values['import'];
      $account->is_global = $values['is_global'];
      $accounts[$id] = $account;
    }
    else {
      $accounts[$id] = NULL;
    }
  }
  return $accounts[$id];
}