Closed (fixed)
Project:
Tweet
Version:
6.x-1.4
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Reporter:
Created:
22 Feb 2009 at 03:01 UTC
Updated:
12 Mar 2009 at 05:40 UTC
I'd like to be able to add a hashtag onto the node title that gets tweeted out. or an @tag.
How do I do this? I've tried adding the tag into the code in a few places, but the automatic urlencoding keeps goofing things up.
Where do I add this to the module?
Comments
Comment #1
icecreamyou commentedIt's not possible to avoid the urlencoding, but you should want it urlencoded. Otherwise it won't be recognized as a character that should be inserted into the textarea. For example, http://twitter.com/home?status=test%23tag will insert
test#tagin the textarea, but http://twitter.com/home?status=test#tag will insert simplytest.Comment #2
bflora commentedThanks for the speedy response!
Well let me rephrase that.
How do I automatically add a string into the string that gets sent to twitter? What do I need to do to get "#hashtag" to show up when they click the "Post to Twitter" link.
I refuse to believe it's impossible to do. There's got to be a way to do this.
What line of tweet.module.php do I edit and what do I add to it in order to achieve this?
I tried adding it into about 20 different spots in the module's different functions but could never get it working.
Comment #3
icecreamyou commentedReplace line 105 with this:
Replace line 108 with this:
And replace line 113 with this:
...replace #hashtag with whatever tag you want obviously.
That should add the tag into the 'status' query string.
Comment #4
bflora commentedNext time you're in Chicago, I will buy you a beer!
Comment #5
icecreamyou commentedCheers! Glad it works.
Comment #6
bflora commentedWell actually, it doesn't.
I read somewhere that Drupal urlencodes any string that gets passed through an array or something. What I'm seeing when I make these edits is %23hashtag rather than #hashtag.
Is there one more line in there somewhere that we need to fix?
Comment #7
icecreamyou commentedLike I said already, it's supposed to do that, you want it to do that, in fact you need it to do that or it won't go through as part of the message.
Comment #8
bflora commentedI'm not sure I understand.
So I made those changes. Ok.
When i click on the "Post to twitter" link I get this as a URL on the "post to twitter" link
http://twitter.com/home?status=www.zmt85.th8.us%20The%20Future%20of%20Pr...
When I click that I see this in my twitter status box:
www.zmt85.th8.us The Future of Print Could be… Digital Presses | MondayNote [del.icio.us] %23JournMe
Notice that last bit? It's giving me the %23 instead of the #.
Is it possible to get the #?
See if an admin can add a hashtag of their choosing, this module gets A LOT more useful, because now it can help your site go viral by adding a little tag to stories tweeted from it.
But right now, its giving me %23hashtag instead of #hashtag
Comment #9
icecreamyou commentedOh, you're getting %2523 instead of%23 in the URL. It's getting encoded twice. Not sure why that would be unless you did it differently than what I suggested but I'll look into it when I get home.
Comment #10
icecreamyou commentedOkay, so it turns out that the way I was using l() to create links double-urlencodes the '#' sign. Luckily there's a way around it... but instead of just giving you the code here, I added a way to add anything you want to the end of the tweet on the settings page. Tested on and committed to both the 5.x and 6.x branches, so it will be in the next release.
Comment #11
bflora commentedPERFECT. A gold star for you.
I think this little added feature will be aces. can't wait until the next release.