You are here

function twitter_actions_account_options in Twitter 7.6

Same name and namespace in other branches
  1. 6.5 twitter_actions/twitter_actions.module \twitter_actions_account_options()
  2. 7.5 twitter_actions/twitter_actions.module \twitter_actions_account_options()

Returns a list of authenticated Twitter accounts to be used as options.

This will only list accounts that are either global or are owned by the current user.

Return value

array of screen_name => screen_name entries.

2 calls to twitter_actions_account_options()
twitter_actions_set_status_action_form in twitter_actions/twitter_actions.module
Returns a form definition so the Twitter action can be configured.
_twitter_rules_account_options in twitter_actions/twitter_actions.rules.inc
Returns the list of Twitter accounts to be used for posting.

File

twitter_actions/twitter_actions.module, line 82
Exposes Drupal actions for sending Twitter messages.

Code

function twitter_actions_account_options() {
  global $user;
  module_load_include('inc', 'twitter');
  $twitter_accounts = twitter_load_authenticated_accounts($user->uid);
  $options = array();
  foreach ($twitter_accounts as $twitter_account) {
    $options[$twitter_account->screen_name] = '@' . $twitter_account->screen_name;
  }

  // Extra token to use current user's account.
  $options['[current user]'] = '[current user]';
  return $options;
}