Keyword

Tiny URL not working on 'Tweet this to your followers'

  • Lynn Heighton
  • Lynn Heighton's Avatar Topic Author
  • Offline
  • New Member
More
15 years 7 months ago #73507 by Lynn Heighton
Hi,
I've created some pages on my site for latest news and job vacancies and have included the twitter social integration link for 'tweet this to your followers'
However, when I click this, it opens my link in Twitter but doesn't add a TINY URL.
I've checked in the K2 parameters and the option to show Tiny URL is checked.
If I uncheck this then the tweet shows the link, but it is too long.

Any ideas? Thanks in advance

Please Log in or Create an account to join the conversation.

More
15 years 7 months ago #73508 by pembaris
have you tried sign up with bit.ly and integrates with Twitter?

Last time I was using this for JReview, and I signed up Bit.ly, then I added my Twitter accounts on bit.ly page. I don't know if this will solve your problem, but maybe worth a try.

ps: k2 are becoming so popular, they are having shortage of workers. They never answer these days.

Please Log in or Create an account to join the conversation.

More
15 years 2 months ago #73509 by Ivan Descartes
Replied by Ivan Descartes on topic Tiny URL not working on 'Tweet this to your followers'
In my case, this was because the file_get_contents function in PHP is disabled by my host. This is a common hosting restriction, for security. I fixed this by replacing it with CURL function instead. To make the fix, find components/com_k2/views/item/view_html.php and replace:

if ($params->get('itemTwitterLink') && $params->get('twitterUsername')) {
$itemURLForTwitter = ($params->get('tinyURL')) ? @file_get_contents('tinyurl.com/api-create.php?url='.$item->absoluteURL) : $item->absoluteURL;
$item->twitterURL = 'twitter.com/home/?status='.urlencode('Reading @'.$params->get('twitterUsername').' '.$item->title.' '.$itemURLForTwitter);
}

With:

if ($params->get('itemTwitterLink') && $params->get('twitterUsername')) {

$itemURLForTwitter = $item->absoluteURL;

if($params->get('tinyURL')) {
$ch = curl_init();
$timeout = 5;
curl_setopt($ch, CURLOPT_URL,'tinyurl.com/api-create.php?url='.$item->absoluteURL);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$itemURLForTwitter = curl_exec($ch);
curl_close($ch);
}

$item->twitterURL = 'twitter.com/home/?status='.urlencode('Reading @'.$params->get('twitterUsername').' '.$item->title.' '.$itemURLForTwitter);
}

Please Log in or Create an account to join the conversation.

More
15 years 2 weeks ago #73510 by Simon Olsen
Before I start hacking my K2, has anyone else successfully done this? (No offense Ivan, I'm sure it works).

Ivan Descartes said:In my case, this was because the file_get_contents function in PHP is disabled by my host. This is a common hosting restriction, for security. I fixed this by replacing it with CURL function instead. To make the fix, find components/com_k2/views/item/view_html.php and replace...

Please Log in or Create an account to join the conversation.

  • Manolis Markatselas
  • Manolis Markatselas's Avatar
  • Offline
  • New Member
More
14 years 9 months ago #73511 by Manolis Markatselas
Replied by Manolis Markatselas on topic Tiny URL not working on 'Tweet this to your followers'
Excellent. This working fine.

Please Log in or Create an account to join the conversation.

  • Raymond Ringston
  • Raymond Ringston's Avatar
  • Offline
  • Junior Member
More
14 years 9 months ago #73512 by Raymond Ringston
Replied by Raymond Ringston on topic Tiny URL not working on 'Tweet this to your followers'
Worked perfectly. Thank you!

Please Log in or Create an account to join the conversation.

More
14 years 6 months ago #73513 by Omar Al-Ansari
Replied by Omar Al-Ansari on topic Tiny URL not working on 'Tweet this to your followers'
Works GREAT :D


Ivan Descartes said:In my case, this was because the file_get_contents function in PHP is disabled by my host. This is a common hosting restriction, for security. I fixed this by replacing it with CURL function instead. To make the fix, find components/com_k2/views/item/view_html.php and replace:
if ($params->get('itemTwitterLink') && $params->get('twitterUsername')) {
$itemURLForTwitter = ($params->get('tinyURL')) ? @file_get_contents('tinyurl.com/api-create.php?url='.$item->absoluteURL) : $item->absoluteURL;
$item->twitterURL = 'twitter.com/home/?status='.urlencode('Reading @'.$params->get('twitterUsername').' '.$item->title.' '.$itemURLForTwitter);
}

With:

if ($params->get('itemTwitterLink') && $params->get('twitterUsername')) {

$itemURLForTwitter = $item->absoluteURL;

if($params->get('tinyURL')) {
$ch = curl_init();
$timeout = 5;
curl_setopt($ch, CURLOPT_URL,'tinyurl.com/api-create.php?url='.$item->absoluteURL);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$itemURLForTwitter = curl_exec($ch);
curl_close($ch);
}

$item->twitterURL = 'twitter.com/home/?status='.urlencode('Reading @'.$params->get('twitterUsername').' '.$item->title.' '.$itemURLForTwitter);
}

Please Log in or Create an account to join the conversation.

More
14 years 5 months ago #73514 by depika k.
yes it works great !! Thanks for the tip !!

Please Log in or Create an account to join the conversation.

More
14 years 1 month ago #73515 by Matt Payne
Thanks this fixed it for me too!

Please Log in or Create an account to join the conversation.

More
14 years 1 month ago #73516 by Simon Olsen
Worked here too. Thank you.

Please Log in or Create an account to join the conversation.

More
13 years 11 months ago #73517 by NosyWeb
It worked but now twitter change the link :

twitter.com/home/?status=Reading.........

 

in :

twitter.com/#!/?status=Reading......

 

and it's doesn't work.

Some ideas to fix this problem ?

 

Thanks.

Please Log in or Create an account to join the conversation.

More
13 years 11 months ago #73518 by Jason See
I, too, am having trouble getting this to work correctly. The link passes to Twitter, but the form is not pre-populated for the user to submit.

Please Log in or Create an account to join the conversation.

More
13 years 11 months ago #73519 by Rishona Campbell
Replied by Rishona Campbell on topic Tiny URL not working on 'Tweet this to your followers'
It doesn't work for me either. Before I change the code, can anyone verify that the above suggestion still works? The post is from 2010 and Twitter has changed since then...

Please Log in or Create an account to join the conversation.

More
13 years 11 months ago #73520 by Rishona Campbell
Replied by Rishona Campbell on topic Tiny URL not working on 'Tweet this to your followers'
I did try the change (using CURL). Still doesn't work. :-(

Please Log in or Create an account to join the conversation.

More
13 years 11 months ago #73521 by Rishona Campbell
Replied by Rishona Campbell on topic Tiny URL not working on 'Tweet this to your followers'
Maybe...we'll have to see!

 

Please Log in or Create an account to join the conversation.

More
13 years 11 months ago #73522 by dsa787
I am having the same problem too, it takes me to twitter but it doesn't create a tiny url in the message box. It was working fine. Last time I've used it was on 5/11/11 and I've tried it yesterday (5/21/11) and it doesn't work. Any help will be appreciated.

 

marco said:

Yah I noticed this today as well. The link goes to twitter but then doesn't populate the text or url in the little twitter box. Has something changed with Twitter?

Please Log in or Create an account to join the conversation.

More
13 years 11 months ago #73523 by devsmi
I have a fix for this. I am offering this to all but you must visit www.devsmi.com and register (quick easy and free) and once you login you will see "
Tiny URL not working on 'Tweet this to your followers'
 in the blog. Good luck let me know if this works for you.

Please Log in or Create an account to join the conversation.

More
13 years 11 months ago #73524 by Rishona Campbell
Replied by Rishona Campbell on topic Tiny URL not working on 'Tweet this to your followers'
Ah...ok, I tried your fix and it worked! Thank you! The only thing though is that the article's title in the tweet is concatenated with a '+' in between the words. Any way to fix this?

 

Thank you again though!devsmi said:

I have a fix for this. I am offering this to all but you must visit www.devsmi.com and register (quick easy and free) and once you login you will see "Tiny URL not working on 'Tweet this to your followers'
 in the blog. Good luck let me know if this works for you.

Please Log in or Create an account to join the conversation.

More
13 years 11 months ago #73525 by devsmi
I had no problems when testing this myself. Could I see your site ?

Please Log in or Create an account to join the conversation.

More
13 years 11 months ago #73526 by Rishona Campbell
Replied by Rishona Campbell on topic Tiny URL not working on 'Tweet this to your followers'
Sure...it's www.rishonan.net devsmi said:
I had no problems when testing this myself. Could I see your site ?

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum