Module Twitter (not Twitter Action, sorry for the mistake) on Drupal 7.22

Once the filter Twitter #hashtag converter is selected into

Configuration -> Text formats -> _SELECT_YOUR_FORMAT_ -> Enable filters -> Twitter #hashtag converter

Writing an Hashtag into a field, it is converted into a link to Twitter as described here
"Converts Twitter-style #hashtags into links to hashtags.org."

But the converted hashtag has wrong address, which leads always to a non existing page on Twitter.

For instance;: if I write the hashtag: #Tomorrow, the converted link is:

https://search.twitter.com/search?q=%23Tomorrow

which leads to "Sorry, that page doesn’t exist! Thanks for noticing—we're going to fix it up and have things back to normal soon."

The correct address should be:
https://twitter.com/search?q=%23Tomorrow&src=hash

Comments

HyperD’s picture

To make it works, I made these modifications:

Twitter.module
<9	define ('TWITTER_SEARCH',       'http://search.twitter.com');
>9	define ('TWITTER_SEARCH',       'https://twitter.com');

<243	    '!url' => '<a href="https://search.twitter.com/">search.twitter.com</a>')
>243	    '!url' => '<a href="https://twitter.com/">twitter.com</a>')

<283	    '><a href="' . $destination . '${1}">' . $prefix . '${1}</a>',
>283	    '><a href="' . $destination . '${1}&src=hash">' . $prefix . '${1}</a>',

Pay attention: it's necessary to uninstall the module also clicking on the tab Uninstall.
After the modification, reinstall the module

Of course it's possible to change the setup in Configuration -> Twitter.
However in the manner above, the module has already the correct settings by default.

plopesc’s picture

Version: 7.x-5.7 » 7.x-6.x-dev
Component: Twitter Actions » User interface

Hello,

Attaching patch which tries to fix this bug, basically changes the default twitter_search url, adds a $suffix parameter to _twitter_filter_text to add the new $srcparameter and changes the filter tip dependingon the twitter_search variable.

Patch has been tested against 7.x-5.x and 7.x-6.x branches.

Regards

plopesc’s picture

Status: Active » Needs review
StatusFileSize
new2.14 KB

Patch and changing status.

HyperD’s picture

Thank you very much Plopesc

jamix’s picture

Status: Needs work » Needs review

Introducing $suffix is not necessary because the following happily works:

https://twitter.com/search?q=%23Tomorrow

I.e. we should just change the search prefix from http://search.twitter.com/ to https://twitter.com/.

jamix’s picture

Status: Needs review » Needs work

Changing issue status.

jamix’s picture

StatusFileSize
new1.23 KB

Attaching (the much simpler) patch.

jamix’s picture

Issue summary: View changes

Corrections

royal121’s picture

Issue summary: View changes
StatusFileSize
new1.13 KB

Here's re-rolled patch.

royal121’s picture

StatusFileSize
new1.13 KB
thomas.fleming’s picture

Patch wouldn't apply against 5.8. It was trying to apply to newtwitter.module. Rerolled. Needs to be tested against 6.

estoyausente’s picture

StatusFileSize
new1.23 KB

@tidrif I can't apply the patch, it have wrong base path. It have to be without 'sites/all/modules/contrib/twitter'.

I upload again. Please, review it.

juampynr’s picture

Status: Needs review » Closed (duplicate)