Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#5 | 1084087-twitter-pull-favorites.patch | 682 bytes | serenecloud |
Comments
Comment #1
dennis best CreditAttribution: dennis best commentedGrrr. Oops... the pull code would be...
Comment #2
amedjones CreditAttribution: amedjones commentedWhy 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?
Comment #3
amedjones CreditAttribution: amedjones commentedsolved my issue, I had to use module_load_include() .. but i dont know why, the module im extracting the function from is enabled
Comment #4
dennis best CreditAttribution: dennis best commentedI'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.
Comment #5
serenecloud CreditAttribution: serenecloud commentedThe 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.
Comment #6
Agileware CreditAttribution: Agileware commentedI have tested the patch in #5 and it works as expected.
Comment #7
Agileware CreditAttribution: Agileware commentedPatch also applies fine to drupal 7 version.
Bumping version in the hopes it might be noticed and then can be back ported to 6.
Comment #8
liza CreditAttribution: liza commentedhi,
is there a D6 patch for this?
thnx in advance.
Comment #9
serenecloud CreditAttribution: serenecloud commentedliza: This patch runs fine on the D6 version (and was originally for it)
Comment #10
Agileware CreditAttribution: Agileware commentedYep, I'm using it on drupal 6 and 7 and works for both.
Comment #11
jec006 CreditAttribution: jec006 commentedPatch committed to 7 branch here: http://drupal.org/commitlog/commit/12844/5682594349c3c44e2325244686c3c8c...
Thanks for all the work
Comment #12
jec006 CreditAttribution: jec006 commentedComment #14
serenecloud CreditAttribution: serenecloud commentedI'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)
Comment #15
serenecloud CreditAttribution: serenecloud commented*bump*
Comment #16
yngens2 CreditAttribution: yngens2 commentedThe patch does not apply with Twitter Pull 6.x-2.0-alpha2 anymore, giving the error:
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:
However, it is till unclear how to pull the favorite tweets, so I am supporting serenecloud's original request.
Comment #17
nickonom CreditAttribution: nickonom commentedSince Drupal 6 reached EOL, let's switch this request to Drupal 7.