You are here

function tweet_feed_get_feed_object in Tweet Feed 7.2

Same name and namespace in other branches
  1. 7.3 tweet_feed.module \tweet_feed_get_feed_object()

Get data on specific feed

Get the information from our feed and accounts table on a per-feed basis for the purposes of starting the import for that feed.

Parameters

int fid: The id of the feed for which we want to retrieve the data as an object

Return value

object feed The feed data object for the requested feed

3 calls to tweet_feed_get_feed_object()
tweet_feed_cron in ./tweet_feed.module
Implements hook_cron().
tweet_feed_pull_data_from_feed in ./tweet_feed.module
Get Twitter Data
tweet_feed_run_import in ./tweet_feed_admin.inc
Run the Import

File

./tweet_feed.module, line 277

Code

function tweet_feed_get_feed_object($fid) {

  // If we are not passed an fid, then return false (sanity check)
  if (empty($fid)) {
    return FALSE;
  }

  // We should only ever have one of these since we're pulling by feed and a feed can only
  // have only one API source.
  $query = db_select('tweet_feeds', 'f');
  $query
    ->join('tweet_accounts', 'a', 'a.aid = f.aid');
  $query
    ->fields('f', array(
    'fid',
    'query_type',
    'timeline_id',
    'search_term',
    'list_name',
    'pull_count',
    'clear_prior',
    'new_window',
  ));
  $query
    ->fields('a', array(
    'consumer_key',
    'consumer_secret',
    'oauth_token',
    'oauth_token_secret',
  ));
  $query
    ->condition('f.fid', $fid);
  $result = $query
    ->execute();
  $feed = $result
    ->fetchObject();
  return $feed;
}