Skip to content

Commit

Permalink
new filter, "dw_twitter_api_get_tweets" for retrieving tweets from di…
Browse files Browse the repository at this point in the history
…fferent endpoints
  • Loading branch information
jtsternberg committed Mar 5, 2014
1 parent b507f45 commit 2c42392
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions dsgnwrks-twitter-importer.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,16 @@ public function import() {
$id = $_POST[$this->optkey]['username'];
if ( !isset( $_GET['tweetimport'] ) || empty( $id ) ) return;

// @TODO https://dev.twitter.com/docs/working-with-timelines
$tweets = $this->twitterwp()->get_tweets( $id, 200 );
$TwitterWP = $this->twitterwp();

// Filter to override TwitterWP method for getting tweets
$tweets = apply_filters( 'dw_twitter_api_get_tweets', null, $TwitterWP, $this );

// If no override, proceed as usual
if ( null === $tweets ) {
// @TODO https://dev.twitter.com/docs/working-with-timelines
$tweets = $TwitterWP->get_tweets( $id, 200 );
}

if ( is_wp_error( $tweets ) ) {
echo '<div id="message" class="error"><p>'. implode( '<br/>', $tweets->get_error_messages( 'twitterwp_error' ) ) . '</p></div>';
Expand Down

0 comments on commit 2c42392

Please sign in to comment.