Here's a hack I use to pull favorite tweets.

I add this to the twitter_pull.class.inc file before line 60

	// if the first character is ~, then consider the key a favorites feed
    elseif ($prefix == "~") {
      $key = drupal_substr($this->twitkey, 1);
      $url = 'http://api.twitter.com/1/favorites/'.urlencode($key).'.json?count='.$num;   
    }

Then I just use this snippet to generate a list of Tweets that I've marked as favorites:

<?php if (function_exists('twitter_pull_render')) { print twitter_pull_render('@openpublish', 'OpenPublish', 10); } ?>

I'm not sure I'm recommending this as a patch per se. After all the ~ prefix is completely arbitrary.

But I felt compelled to share it.

CommentFileSizeAuthor
#5 1084087-twitter-pull-favorites.patch682 bytesserenecloud
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dennis best’s picture

Grrr. Oops... the pull code would be...

<?php if (function_exists('twitter_pull_render')) { print twitter_pull_render('~dennisbest', 'Favorites', 10); } ?>

amedjones’s picture

Why is it that when I try to use twitter_pull_render () in my module i get a undefined function error?

here's my code
$output = twitter_pull_render();

Do i need to add anything to my module.info?

amedjones’s picture

solved my issue, I had to use module_load_include() .. but i dont know why, the module im extracting the function from is enabled

dennis best’s picture

I'm not sure what you mean. Is the module working without the change above? Might be a separate issue?

All my change/hack does is make the "~" work similar to the way the "@" works. We are simply adding another IF clause.

But instead of getting a particular user's feed as the "@" does, we get the users favorites.

Again, I only mention it for those who, like me want to use "favorites" as a way to filter the tweets that get displayed. (I don't want all of my cranky political comments on Twitter to show up on my tech blog and turn readers off.) It's also a great way to include really good tweets from other people, friends, family, etc.

serenecloud’s picture

Status: Active » Reviewed & tested by the community
FileSize
682 bytes

The patch works nicely for me - thanks for posting it. I've re-rolled it as a patch file so it's easier for people to apply.

Agileware’s picture

I have tested the patch in #5 and it works as expected.

Agileware’s picture

Version: 6.x-1.2 » 7.x-1.x-dev

Patch also applies fine to drupal 7 version.
Bumping version in the hopes it might be noticed and then can be back ported to 6.

liza’s picture

hi,

is there a D6 patch for this?

thnx in advance.

serenecloud’s picture

liza: This patch runs fine on the D6 version (and was originally for it)

Agileware’s picture

Yep, I'm using it on drupal 6 and 7 and works for both.

jec006’s picture

Patch committed to 7 branch here: http://drupal.org/commitlog/commit/12844/5682594349c3c44e2325244686c3c8c...

Thanks for all the work

jec006’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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

serenecloud’s picture

Version: 7.x-1.x-dev » 6.x-1.2
Status: Closed (fixed) » Reviewed & tested by the community

I'm reopening this and changing the version as I'm still hoping to get it into the Drupal 6 (which is what I use and the original patch was for D6)

serenecloud’s picture

*bump*

yngens2’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Active

The patch does not apply with Twitter Pull 6.x-2.0-alpha2 anymore, giving the error:

patch < *patch
patching file twitter_pull.class.inc
Hunk #1 succeeded at 70 with fuzz 2 (offset 13 lines).

Manually entering the suggested code (not into line 60 this time, but several lines further down) also did't work. I don't know if the module developers chose another approach, but the file twitter_pull.class.inc contains the following lines:

      case "~":
        // Looking for favorites.
        $path                         = "favorites/list";
        $params['screen_name']        = $key;
        break;

However, it is till unclear how to pull the favorite tweets, so I am supporting serenecloud's original request.

I'm reopening this and changing the version as I'm still hoping to get it into the Drupal 6 (which is what I use and the original patch was for D6)

nickonom’s picture

Version: 6.x-1.2 » 7.x-1.0-rc5

Since Drupal 6 reached EOL, let's switch this request to Drupal 7.