You are here

function twitter_load_accounts in Twitter 7.6

Same name and namespace in other branches
  1. 6.5 twitter.inc \twitter_load_accounts()
  2. 7.5 twitter.inc \twitter_load_accounts()

Loads all Twitter accounts added by a Drupal user.

This excludes Twitter accounts added automatically when, for example, pulling mentions of an account from the Twitter API.

Return value

array A list of TwitterAccount objects.

3 calls to twitter_load_accounts()
twitter_load_account_names in ./twitter.inc
Bare list of all account names, keyed by Twitter ID.
twitter_load_authenticated_accounts in ./twitter.inc
Returns a list of authenticated global or user-specific Twitter accounts.
twitter_user_settings in ./twitter.pages.inc
Form builder that lists Twitter accounts.

File

./twitter.inc, line 88

Code

function twitter_load_accounts() {
  $query = new EntityFieldQuery();
  $query
    ->entityCondition('entity_type', 'twitter_account')
    ->propertyCondition('uid', 0, '<>')
    ->propertyOrderBy('screen_name');
  $result = $query
    ->execute();
  $ids = !empty($result['twitter_account']) ? array_keys($result['twitter_account']) : array();
  if (count($ids)) {
    return entity_load('twitter_account', $ids);
  }
  else {
    return array();
  }
}