I cannot seem to find a way to display the full twitter feed including retweets. Currently all the feed pulls only show actual tweets and not retweets. Is there a way to show everything??

CommentFileSizeAuthor
#16 Screenshot.png108 KBjuampynr
#4 twitter.patch2.57 KBnobodyiscertain

Comments

fregan’s picture

My bad. I did not realize that twitter excludes retweets from the XML and JSON calls by default. http://dev.twitter.com/doc/get/statuses/user_timeline

So with that, anyone have a good suggestion on how to place the include_rts parameter in the call?? What file would I change to get this to happen?

goins.29’s picture

I just recently ran into this problem, and this is what I did to get it to work.

In the twitter.inc file, I changed the twitter_fetch_timeline definition to include a new optional parameter, $include_retweets, then slightly modified the "since" query string append like so:

//function twitter_fetch_timeline($screen_name, $filter_since = TRUE, $cache = TRUE) {
function twitter_fetch_timeline($screen_name, $filter_since = TRUE, $cache = TRUE, $include_retweets = FALSE) {
  //$url = "http://" . variable_get('twitter_api_url', 'twitter.com') . "/statuses/user_timeline/$screen_name.xml";
  $url = "http://" . variable_get('twitter_api_url', 'api.twitter.com/1') . "/statuses/user_timeline/$screen_name.xml" . ($include_retweets == TRUE ? "?include_rts=1" : "");

  if (!empty($since)) {
    $url .= ($include_retweets == TRUE ? '&' : '?') . 'since='. urlencode($since);
  }
.

Under the twitter setup in site configuration, I changed the Alternate API URL from the default value I had of "twitter.com" to "api.twitter.com/1".

After that, I just updated my calls to twitter_fetch_timeline($account_name) to twitter_fetch_timeline($account_name, TRUE, TRUE, TRUE). Of course, if you are always going to want re-tweets (or at least by default), you can just set the default value of $include_retweets to TRUE, then just use twitter_fetch_timeline($account_name).

I'm still a little green with PHP, so feel free to edit/enhance my code as needed...

nancydru’s picture

Can you do a patch, please? Did you set up any kind of admin setting?

nobodyiscertain’s picture

StatusFileSize
new2.57 KB

Here's a patch I created off of goins.29's code.

I did add an admin setting in the Twitter settings to Import Retweets. Make sure you change the "twitter.com" value in Alternate API URL to "api.twitter.com/1" and you'll be good to go.

JStarcher’s picture

Thanks!

nancydru’s picture

Status: Active » Needs review
+	if ($include_retweets) {
+		$url .= "include_rts=1&";
+	}

This ends up being in the code twice?

Drupal coding standards say no tabs, please. Two spaces instead.

nancydru’s picture

Status: Needs review » Needs work

I am not a Twitterer, so I may be looking at the wrong stuff, but my tester says the re-tweets are not showing up. I have run cron, just in case.

I did click on "Import Retweets" and set the "Alternate API URL" to "api.twitter.com/1".

nancydru’s picture

Any other ideas?

Gilneas’s picture

I did apply this patch and it seems retweets are working right now.
I will have my eyes on this and give feedback.

nancydru’s picture

Status: Needs work » Reviewed & tested by the community

Even though I ran Cron when I put this in, it seems to have taken some more cycles to show them.

Dubber Dan’s picture

Going to give this a whirl running the patch, so will report back

Gilneas’s picture

Patch works for me.

geufroi’s picture

I have only few month of drupal experience...
I don't know how to apply a patch
could you be kind enough to give us the "how to" guide to process to apply this patch.
If thats time consuming to you, please provide few key steps...
thanks again

nancydru’s picture

Better yet, commit the patch.

steinmb’s picture

Version: 6.x-2.6 » 6.x-3.x-dev
Status: Reviewed & tested by the community » Needs work

Pls. reroll against latest 6.x-3 dev.

juampynr’s picture

StatusFileSize
new108 KB

In June of this year an "Include retweets" option was added to the module.

Please upgrade to the latest stable release available at http://drupal.org/project/twitter.

juampynr’s picture

Status: Needs work » Fixed

Changing status as fixed.

rene_w’s picture

"Fixed"? I can't seem to get retweets to show up -- the "Reweets" checkbox doesn't change anything for me. On the Twitter web site, all the retweets are visible. The other tweets are shown.

I've just tried installing twitter-6.x-3.0-beta9 (on Drupal 6.22), re-ran cron, deleted and re-added the Twitter account, but no luck. Any suggestions on how to debug this?

rene_w’s picture

Ok, I found this thread #1182170: Import Twitter-style Retweets on cron run and the patch described @#10 (using api.twitter.com/1) also worked for me. FWIW, I'm using the module without OAuth and it were the "native" Twitter retweets that didn't show up.

steinmb’s picture

Glad that quick fix worked out for you. Pls. join in at #1182170: Import Twitter-style Retweets on cron run, have your say, test patches so we are sure that it get fixed (one more time).

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.