- Posts: 13
COMMUNITY FORUM
- Forum
- K2 Community Forum
- English K2 Community
- Tiny URL not working on 'Tweet this to your followers'
Tiny URL not working on 'Tweet this to your followers'
- Lynn Heighton
- Topic Author
- Offline
- New Member
Less
More
15 years 12 hours ago #73507
by Lynn Heighton
Tiny URL not working on 'Tweet this to your followers' was created 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
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.
- pembaris
- Offline
- New Member
Less
More
- Posts: 7
14 years 11 months ago #73508
by pembaris
Replied by pembaris on topic Tiny URL not working on 'Tweet this to your followers'
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.
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.
- Ivan Descartes
- Offline
- New Member
Less
More
- Posts: 10
14 years 7 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);
}
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.
- Simon Olsen
- Offline
- Junior Member
Less
More
- Posts: 34
14 years 5 months ago #73510
by Simon Olsen
Replied by Simon Olsen on topic Tiny URL not working on 'Tweet this to your followers'
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...
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
- Offline
- New Member
Less
More
- Posts: 10
14 years 2 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
- Offline
- Junior Member
Less
More
- Posts: 32
14 years 2 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.
- Omar Al-Ansari
- Offline
- New Member
Less
More
- Posts: 14
13 years 10 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);
}
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.
- depika k.
- Offline
- New Member
Less
More
- Posts: 2
13 years 10 months ago #73514
by depika k.
Replied by depika k. on topic Tiny URL not working on 'Tweet this to your followers'
yes it works great !! Thanks for the tip !!
Please Log in or Create an account to join the conversation.
- Matt Payne
- Offline
- New Member
Less
More
- Posts: 11
13 years 6 months ago #73515
by Matt Payne
Replied by Matt Payne on topic Tiny URL not working on 'Tweet this to your followers'
Thanks this fixed it for me too!
Please Log in or Create an account to join the conversation.
- Simon Olsen
- Offline
- Junior Member
Less
More
- Posts: 34
13 years 6 months ago #73516
by Simon Olsen
Replied by Simon Olsen on topic Tiny URL not working on 'Tweet this to your followers'
Worked here too. Thank you.
Please Log in or Create an account to join the conversation.
- Forum
- K2 Community Forum
- English K2 Community
- Tiny URL not working on 'Tweet this to your followers'