View Full Version : Miscellaneous Hacks - vBulletin to Twitter, live tweets of new threads
buro9
01-26-2010, 10:00 PM
This should work on all 4 and 3 versions of vBulletin as it's trivial.
Description:
You start a new thread, this hack makes a tweet about it on your twitter account.
This are live updates... not delayed, not based on RSS... the instant the thread is started, a tweet is made. This is how this hack differs from other hacks.
Why:
Mostly for SEO, but also as an alert system.
For SEO the idea is simply that search engines are drinking from the Twitter firehose and are indexing the links that are tweeted. Faster and increased indexing of your site benefits you by helping it be found.
For alerts it means that users are able to use whatever twitter client they wish to obtain updates. A lot of these provide filtering capabilities, so they're able to get a live filtered stream of updates that interest them. This works very well when you also use thread prefixes.
Pre-requisites:
You should have an account on bit.ly for URL shortening, and you should have an account on Twitter.
Go and register if you haven't yet:
http://bit.ly/
http://twitter.com/
Installation:
NOTE: Most problems are related to not putting your bit.ly or twitter user details in the plugin. Follow the instructions carefully!
Upload the two attached files to your forum root. These are twitter and bitly classes that enable the hack to work, you can also download these from the author:
http://classes.verkoyen.eu/bitly
http://classes.verkoyen.eu/twitter/
Go to the plugin manager and create a new plugin with the following details:
Product: vBulletin
Hook: newthread_post_complete
Title: Tweet to Twitter
PHP Code: [See below]
To configure the PHP code you need to know your bit.ly API key (go get it from bit.ly/account (http://bit.ly/account/)) and your username and password for twitter.
You also should make a list of the forumIds that are non-public as you will want to put these in the array provided.
i.e. if your admin forum is forumId = 7 and you also have a private forum for regular members which is forumid = 12, then you will want this:
$excludedForums = array(7, 12);
The PHP code should be this, with all of the relevant values for your forum inserted (replace everything bolded, including the < and > bits):
// The array below are the ids of non-public forums, update these to be your admin forum ids or anything non-public by default
$excludedForums = array(0);
// If you are having trouble getting bitly URL shortening to work... disable it!
$useBitly = true;
if (!in_array($foruminfo[forumid], $excludedForums)) {
$shortUrl = 'http://www.yourforumsdomain.com/showthread.php?t='.$newpost[threadid];
if ($useBitly) {
// http://classes.verkoyen.eu/bitly
require_once 'bitly.php';
$bitly = new Bitly('<bit.ly username>', '<bit.ly API key>');
$shortUrl = $bitly->shorten($shortUrl);
}
$tweet = '';
if (isset($newpost['prefixid']) && $newpost['prefixid'] != '') {
$tweet = $vbphrase['prefix_'.$newpost['prefixid'].'_title_plain'].' ';
}
$tweet .= $newpost['title'].' '.$shortUrl;
// http://classes.verkoyen.eu/twitter/
require_once 'twitter.php';
$twitter = new Twitter('<twitter username>','<twitter password>');
$twitter->updateStatus($tweet);
}
So the bit.ly line might look like this after you've put your values in:
$bitly = new Bitly('testUser', 'R_hj3456hgf3hig56hi2gf6');
NOT
$bitly = new Bitly('<testUser>', '<R_hj3456hgf3hig56hi2gf6>');
See? Remove those <> bits, they just show what to replace.
The shortUrl line might look like this:
$shortUrl = 'http://www.vbulletin.com/forum/showthread.php?t='.$newpost[threadid];
The Twitter line might look like this:
$twitter = new Twitter('stephenfry','op1umisn1ce');
All make sense?
And that's it. Save and activate the plugin and create a test thread.
Now whenever a new thread is started, a tweet will be made to twitter instantly.
You can see this in effect here:
http://twitter.com/lfgss
That is being pushed new threads for http://www.lfgss.com/ and it's working perfectly.
Any questions?
FAQ (Frequently Asked Questions)
Q: It doesn't work!
A: That's not a question, however if it doesn't work then it's extremely likely you got your username and passwords wrong or left the < > signs in there. Double-check and do it again.
Q: I see an "INVALID_JSON" error
A: Disable bitly by setting $useBitly to false.
Q: I see an "You must be authenticated to access shorten" error
A: The credentials that you entered are either wrong, or you made a mess of the syntax. You did remove the < > when you put your values in right? Did you check the example given above?
Q: I see an error that says "Warning: curl_setopt_array() [function.curl-setopt-array]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in [path]/bitly.php"
A: Wow, that's a good one... but easily fixable. Insert this at line 136 (just after the CURL options) in bitly.php:
$no_hack_needed = (ini_get('safe_mode') !== '1' && ini_get('open_basedir') === false);
if ($no_hack_needed) {
$options[CURLOPT_FOLLOWLOCATION] = true;
} else {
$options[CURLOPT_FOLLOWLOCATION] = false;
$options[CURLOPT_HEADER] = true;
}
MOGmartin
01-27-2010, 12:44 PM
I use a self built system very similar to this as well on my site....
the twitter account is http://twitter.com/seoforumsorg - and the board is at http://seoforums.org
from my experience I get around 50-80 new visitors per day using this method, so its recommended by me!
Great Work for sharing this with the community!
buro9
01-27-2010, 12:51 PM
I'm seeing similar numbers. I also think that if you use Friendfeed and hook it up to pull in Twitter that you get double-benefit from it.
hiker
01-27-2010, 01:05 PM
Sounds great, I'll install later this week.
Does this work when ANY thread is started, or just any started by ME? I assume it's any thread.
And does it have the ability to leave certain threads excluded?
Thanks.
buro9
01-27-2010, 01:13 PM
It works for *ALL* threads by everyone.
Currently the only exclusion is to prevent threads started in specific forums from creating tweets.
All existing threads are not tweeted, this code tweets new threads only.
hiker
01-27-2010, 02:30 PM
It works for *ALL* threads by everyone.
Currently the only exclusion is to prevent threads started in specific forums from creating tweets.
All existing threads are not tweeted, this code tweets new threads only.
Thanks, I should have clarified - exclude certain FORUMS ... not threads.
I've got an outdoor forum with a general discussion forum. I'd like to exclude the general discussion forum and only tweet the outdoor related forums.
Thanks again, I'll be installing this week.
buro9
01-27-2010, 02:40 PM
Ah, it does that... just add the "general" forum to the array of excluded forumIds. Job done.
Moondust
01-27-2010, 04:52 PM
Hi, this is not Working, after a new Thread comming the follow Error
You must be authenticated to access shorten on line 193 in /home/erotidbr/erotikforen/forum/bitly.php
#0 /home/erotidbr/erotikforen/forum/bitly.php(382): Bitly->doCall('shorten', Array)
#1 /home/erotidbr/erotikforen/forum/newthread.php(262) : eval()'d code(10): Bitly->shorten('http://www.erot...')
#2 /home/erotidbr/erotikforen/forum/newthread.php(262): eval()
#3 {main}
Warnung: Invalid error type specified in [path]/vb/vb.php (Zeile 284)
Nordinho
01-27-2010, 06:02 PM
Could vbseo be interfering with this? Also, if your forum not in root, what settings do you recommend? Getting the error below. Allthough a post on bit.ly gets made. Just not in Twitter.
Warning: curl_setopt_array() [function.curl-setopt-array]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in [path]/bitly.php on line 141
{ "errorCode": 0, "errorMessage": "", "results": { "http://www.domain.net/forumdir/showthread.php?t=44434": { "hash": "bi7V5B", "shortCNAMEUrl": "http://bit.ly/d0s0TB", "shortKeywordUrl": "", "shortUrl": "http://bit.ly/d0s0TB", "userHash": "d0s0TB" } }, "statusCode": "OK" }
Fatal error: Uncaught exception 'BitlyException' with message 'Invalid JSON-response' in /home/domain.net/public_html/forumdir/bitly.php:196 Stack trace: #0 /home//domain.net/public_html/forumdir/bitly.php(382): Bitly->doCall('shorten', Array) #1 /home/domain.net/public_html/forumdir/newthread.php(273) : eval()'d code(20): Bitly->shorten('http://www.domain...') #2 /home/domain.net/public_html/forumdir/newthread.php(273): eval() #3 /home/domain.net/public_html/forumdir/vbseo.php(1440): require('/home/dom...') #4 {main} thrown in /home/domain.net/public_html/forumdir/bitly.php on line 196
I tried the full path, however then I get this error;
Fatal error: Class 'Bitly' not found in /home/domain.net/public_html/forumdir/newthread.php(273) : eval()'d code on line 19
btw; using vb3.8
buro9
01-27-2010, 06:31 PM
@Moondust
Your error appears to be this: "You must be authenticated to access shorten "
Did you insert your bit.ly username and API key?
You probably want to insert your twitter details too.
The instructions do say to put your values in there.
@Nordinho
I'm using vbseo, and I'm using both 3.8 and 4.0. So no, it's not vbseo that is causing it, and it's not 3.8 causing it.
Could it be this: "CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode "?
Are you in safe mode?
Nordinho
01-27-2010, 06:34 PM
@Nordinho
I'm using vbseo, and I'm using both 3.8 and 4.0. So no, it's not vbseo that is causing it, and it's not 3.8 causing it.
Could it be this: "CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode "?
Are you in safe mode?
Nope, I'm not in safe mode.
buro9
01-27-2010, 06:56 PM
@Nordinho
It appears to be a PHP cURL thing.
Could you try inserting this at line 136 (just after the CURL options) in bitly.php
snippped, see post 22
IF twitter.php also needs it, then it's line 161 of that (after the options) where it will need to be inserted.
Try just putting it in bitly.php to start with and let me know how it goes.
utahraves
01-27-2010, 06:59 PM
I installed this, followed all directions, do not get errors, but do not see the post happening on Twitter.
twitter.com/utahraves
Posted several tests then deleted them after wards but still not posting
EDIT: Ahhhh, It wasn't really clear to me the ARRAY deal. I believe I fixed it now. I'll test
buro9
01-27-2010, 07:13 PM
Getting this error
You must be authenticated to access shorten on line 193 in /home/emonxco/public_html/forum/bitly.php
#0 /home/emonxco/public_html/forum/bitly.php(382): Bitly->doCall('shorten', Array)
#1 /home/emonxco/public_html/forum/newthread.php(262) : eval()'d code(10): Bitly->shorten('http://www.emon...')
#2 /home/emonxco/public_html/forum/newthread.php(262): eval()
#3 {main}
Warning: Invalid error type specified in [path]/vb/vb.php on line 284
The pertinent line: You must be authenticated to access shorten
Have you put in your bit.ly and twitter details?
buro9
01-27-2010, 07:18 PM
EDIT: Ahhhh, It wasn't really clear to me the ARRAY deal. I believe I fixed it now. I'll test
I've just made it clearer by splitting it out, and I've set it to exclude nothing by default.
The pertinent line: You must be authenticated to access shorten
Have you put in your bit.ly and twitter details?
I have added Twitter Details and Bit.Ly details too i am not confirmed about this line
$shortUrl = $bitly->shorten('http://www.yourforumsdomain.com/showthread.php?t='.$newpost[threadid]);
utahraves
01-27-2010, 07:22 PM
Works now. The array is for forums that are NOT supposed to post twitter updates... got it :)
Moondust
01-27-2010, 07:23 PM
@Moondust
Your error appears to be this: "You must be authenticated to access shorten "
Did you insert your bit.ly username and API key?
You probably want to insert your twitter details too.
The instructions do say to put your values in there.
Yes, i have edit the Bit.ly username and Api Key and my Twitter Account Detail in the Plugin PHP Text.
In Bit.ly i have put my twitter account details
buro9
01-27-2010, 07:25 PM
I have added Twitter Details and Bit.Ly details too i am not confirmed about this line
$shortUrl = $bitly->shorten('http://www.yourforumsdomain.com/showthread.php?t='.$newpost[threadid]);
Did you put your domain in there?
Nordinho
01-27-2010, 07:28 PM
@Nordinho
It appears to be a PHP cURL thing.
Could you try inserting this at line 136 (just after the CURL options) in bitly.php
$no_hack_needed = (ini_get('safe_mode') !== '1' && ini_get('open_basedir') === false);
if ($no_hack_needed) {
$curl_opts[CURLOPT_FOLLOWLOCATION] = true;
} else {
$curl_opts[CURLOPT_FOLLOWLOCATION] = false;
$curl_opts[CURLOPT_HEADER] = true;
}
IF twitter.php also needs it, then it's line 161 of that (after the options) where it will need to be inserted.
Try just putting it in bitly.php to start with and let me know how it goes.
Hey buro,
Tried adding it in both files, unfortunately it doesn't make a difference though. Getting the same error.
buro9
01-27-2010, 07:33 PM
Hey buro,
Tried adding it in both files, unfortunately it doesn't make a difference though. Getting the same error.
My fault... it should've been this for bitly.php:
$no_hack_needed = (ini_get('safe_mode') !== '1' && ini_get('open_basedir') === false);
if ($no_hack_needed) {
$options[CURLOPT_FOLLOWLOCATION] = true;
} else {
$options[CURLOPT_FOLLOWLOCATION] = false;
$options[CURLOPT_HEADER] = true;
}
wacnstac
01-27-2010, 07:36 PM
Why not just grab the RSS out from the forum in twitter and feed it to your twitter account with twitterfeed? Am I missing something?
buro9
01-27-2010, 07:39 PM
Why not just grab the RSS out from the forum in twitter and feed it to your twitter account with twitterfeed? Am I missing something?
The live aspect of it.
wacnstac
01-27-2010, 07:42 PM
Ah, I get it now :)
esperone
01-27-2010, 07:42 PM
I get same error as LbR and i have edited the php code to include my bit.ly username and API key as well as my twitter details.
buro9
01-27-2010, 07:45 PM
I get same error as LbR and i have edited the php code to include my bit.ly username and API key as well as my twitter details.
LbR PM'd me... he'd put the username between the < >.
I've just updated the hack instructions to show examples... the details you enter are just PHP strings and should be single-quoted.
esperone
01-27-2010, 07:48 PM
oh i see. Thanks.
Nordinho
01-27-2010, 07:49 PM
My fault... it should've been this for bitly.php:
$no_hack_needed = (ini_get('safe_mode') !== '1' && ini_get('open_basedir') === false);
if ($no_hack_needed) {
$options[CURLOPT_FOLLOWLOCATION] = true;
} else {
$options[CURLOPT_FOLLOWLOCATION] = false;
$options[CURLOPT_HEADER] = true;
}
Allrighty, the curl error is gone. Now on to the next one ;)
This one remains:
Fatal error: Uncaught exception 'BitlyException' with message 'Invalid JSON-response' in /home/domain.net/public_html/forumdir/bitly.php:204 Stack trace: #0 /home/domain.net/public_html/forumdir/bitly.php(390): Bitly->doCall('shorten', Array) #1 /home/domain.net/public_html/forumdir/newthread.php(273) : eval()'d code(20): Bitly->shorten('http://www.nord...') #2/home/domain.net/public_html/forumdir/newthread.php(273): eval() #3 /home/domain.net/public_html/forumdir/vbseo.php(1440): require('/home/dom...') #4 {main} thrown in /home/domain.net/public_html/forumdir/bitly.php on line 204
The OP me helped me working it out :) thanks man works with charm now
buro9
01-27-2010, 08:07 PM
Allrighty, the curl error is gone. Now on to the next one ;)
Scary. You are having fun.
In bitly.php where you have these lines:
// we expect JSON so decode it
$json = @json_decode($response, true); Could you echo $response and then return; out of there so that I can see what the hell bitly returned. The JSON from them should be fine, so I want to be sure it's working at all.
Nordinho
01-27-2010, 08:33 PM
Scary. You are having fun.
In bitly.php where you have these lines:
// we expect JSON so decode it
$json = @json_decode($response, true); Could you echo $response and then return; out of there so that I can see what the hell bitly returned. The JSON from them should be fine, so I want to be sure it's working at all.
Lol, well it's a mod that will save me a lot of time, and an error was fixed, so keeping it positive!
Not to sure what to change exactly though. Tried echoing it out. But I'm getting the same error all the time, so I'm echoing out something wrong.
buro9
01-27-2010, 08:37 PM
Basically this:
echo $response;
exit();
You need to see what is coming back before the exception gets thrown.
Nordinho
01-27-2010, 08:40 PM
Basically this:
echo $response;
exit();
You need to see what is coming back before the exception gets thrown.
Ah oke,
here we go:
HTTP/1.1 200 OK Server: nginx/0.7.42 Date: Wed, 27 Jan 2010 22:39:49 GMT Content-Type: text/html;charset=utf-8 Connection: keep-alive Content-Length: 376 Allow: GET, HEAD, POST Set-Cookie: anonu=psu__ba8fda56-d8f2-4008-9a45-78795aec6c7e---59cd87d95c4bc62d01c0f3740f056d73; Domain=.bit.ly; expires=Wed, 28-Dec-2011 17:39:49 GMT; Path=/; Version=1 Set-Cookie: bsession=e165dfe2-db36-4c65-bde9-3329f63d8df9---7a0a8596aff915c72e69e50dcc22b10a; Domain=.bit.ly; expires=Wed, 28-Dec-2011 17:39:49 GMT; Path=/; Version=1 { "errorCode": 0, "errorMessage": "", "results": { "http://www.nordinho.net/vbull/showthread.php?t=44452": { "hash": "aLLETL", "shortCNAMEUrl": "http://bit.ly/91KLR4", "shortKeywordUrl": "", "shortUrl": "http://bit.ly/91KLR4", "userHash": "91KLR4" } }, "statusCode": "OK" }
buro9
01-27-2010, 08:43 PM
Strange... it's working perfectly fine.
What version of PHP are you using?
Nordinho
01-27-2010, 08:46 PM
Strange... it's working perfectly fine.
What version of PHP are you using?
PHP 5.2.9
It does post as well in bit.ly, it seems to fail at connecting with twitter
buro9
01-27-2010, 09:01 PM
PHP 5.2.9
It does post as well in bit.ly, it seems to fail at connecting with twitter
I don't think it is, it errors in the bit.ly library when it tries to parse the JSON.
The JSON is fine, it's the call to deserialise it that fails.
This: http://php.net/manual/en/function.json-decode.php
I'll have a stab around tomorrow and see if I can figure it out.
Nordinho
01-27-2010, 09:05 PM
Allrighty, thanks for the help sofar!
Getting 500 internal server error, any ideas?
Bouncer222
01-28-2010, 02:43 AM
This mod is all great and I love the idea, never thought of it... but..
How exactly is it helping you get visitors to your site from those viewing your twitter page? I mean...all those threads that are relayed to twitter to be posted have no link backs to your actual vbulletin site, do they? Correct me if I'm wrong.
But if it just copies threads/posts and posts it on tweeter without some sort of link back to original thread... then what's the use?
Again, correct me if I'm wrong.
And thanks for the mod!
blake247
01-28-2010, 03:04 AM
Getting this error
You must be authenticated to access shorten on line 193 in /home/emonxco/public_html/forum/bitly.php
#0 /home/emonxco/public_html/forum/bitly.php(382): Bitly->doCall('shorten', Array)
#1 /home/emonxco/public_html/forum/newthread.php(262) : eval()'d code(10): Bitly->shorten('http://www.emon...')
#2 /home/emonxco/public_html/forum/newthread.php(262): eval()
#3 {main}
Warning: Invalid error type specified in [path]/vb/vb.php on line 284
I have the same error
kisanjong
01-28-2010, 07:53 AM
i was getting the You must be authenticated to access shorten on line 193 error but then realised i had a space after my api code, this was the problem so please check your bitly api codes.
working great thanks installed 5*
zachsg
01-28-2010, 08:51 AM
Installed, properly inserted my bit.ly username and API key and twitter details, post does not happen. No errors, nothing. Just doesn't happen. Something wrong?
Using vB 4.0.1 w/ vbSEO.
Moondust
01-28-2010, 09:12 AM
no Spaces in the API Key and username, all ceck more as 10x Times..... only the Errorcode :-(
IndigoSociety
01-28-2010, 09:27 AM
This is great
tazattitude
01-28-2010, 10:19 AM
Works great! Installed and tested. Neat!!! Anxious to see what it draws!
Thanks for sharing!
cagbaazee
01-28-2010, 12:45 PM
Nothing is working here.. please note is it okay or not
// The array below are the ids of non-public forums, update these to be your admin forum ids or anything non-public by default
if (!in_array($foruminfo[forumid], array(198,58,91,128,52,183,189,199,70,7,31,59,57,6 ,54,52))) {
// http://classes.verkoyen.eu/bitly
require_once 'bitly.php';
// http://classes.verkoyen.eu/twitter/
require_once 'twitter.php';
$bitly = new Bitly('<guru>', '<R_57532588ecb8603c0f14b5b75cbf>');
$shortUrl = $bitly->shorten('http://www.guru.info/vbforum/showthread.php?t='.$newpost[threadid]);
$tweet = '';
if (isset($newpost['prefixid']) && $newpost['prefixid'] != '') {
$tweet = $vbphrase['prefix_'.$newpost['prefixid'].'_title_plain'].' ';
}
$tweet .= $newpost['title'].' '.$shortUrl;
$twitter = new Twitter('<guru>','<zyxjimmy>');
$twitter->updateStatus($tweet);
cagbaazee
01-28-2010, 12:57 PM
Bit.ly username and Api Key - u mean wahera69@hotmail.com and R_5e3b37532588ecb8603c0f14b5b75cba
or
guru and R_5e3b37532588ecb8603c0f14b5b75cb
which is correct
tazattitude
01-28-2010, 01:02 PM
cagbaazee - I did the same thing you did, I left the " < " and the " > " in there. Remove those and it should work as long as you have your un, pw, and the key correct
the bitly should look like this (example)
$bitly = new Bitly('testUser', 'R_hj3456hgf3hig56hi2gf6');
not $bitly = new Bitly('<testUser>', '<R_hj3456hgf3hig56hi2gf6>');
same with the twitter line
Nordinho
01-28-2010, 01:15 PM
I don't think it is, it errors in the bit.ly library when it tries to parse the JSON.
The JSON is fine, it's the call to deserialise it that fails.
This: http://php.net/manual/en/function.json-decode.php
I'll have a stab around tomorrow and see if I can figure it out.
It seems so indeed, commented out the json errors and it posts to twitter (obviously not the shortened url though)
When I post a new thread I get the following error:
{ "errorCode": 0, "errorMessage": "", "results": { "http://www..../forum/showthread.php?t=5559": { "hash": "aQBF2F", "shortCNAMEUrl": "http://bit.ly/bsN5LF", "shortKeywordUrl": "", "shortUrl": "http://bit.ly/bsN5LF", "userHash": "bsN5LF" } }, "statusCode": "OK" }Invalid JSON-response on line 196 in /var/www/vhosts/.../httpdocs/forum/bitly.php
#0 /var/www/vhosts/.../httpdocs/forum/bitly.php(382): Bitly->doCall('shorten', Array)
#1 /var/www/vhosts/.../httpdocs/forum/newthread.php(262) : eval()'d code(12): Bitly->shorten('http://www....')
#2 /var/www/vhosts/.../httpdocs/forum/newthread.php(262): eval()
#3 /var/www/vhosts/.../httpdocs/forum/vbseo.php(1621): require('/var/www/vhosts...')
#4 {main}
Fatal error: Invalid JSON-response on line 196 in [path]/bitly.php in [path]/vb/vb.php on line 284
#0 vb_error_handler(256, Invalid JSON-response on line 196 in /var/www/vhosts/.../httpdocs/forum/bitly.php , /var/www/vhosts/.../httpdocs/forum/vb/vb.php, 284, Array ([exception] => BitlyException Object ([] => Invalid JSON-response,[] => ,[] => 0,[] => /var/www/vhosts/.../httpdocs/forum/bitly.php,[] => 196,[] => Array ([0] => Array ([file] => /var/www/vhosts/.../httpdocs/forum/bitly.php,[line] => 382,[function] => doCall,[class] => Bitly,[type] => ->,[args] => Array ([0] => shorten,[1] => Array ([longUrl] => http://www..../forum/showthread.php?t=5559,[history] => 1))),[1] => Array ([file] => /var/www/vhosts/.../httpdocs/forum/newthread.php(262) : eval()'d code,[line] => 12,[function] => shorten,[class] => Bitly,[type] => ->,[args] => Array ([0] => http://www..../forum/showthread.php?t=5559)),[2] => Array ([file] => /var/www/vhosts/.../httpdocs/forum/newthread.php,[line] => 262,[function] => eval),[3] => Array ([file] => /var/www/vhosts/.../httpdocs/forum/vbseo.php,[line] => 1621,[args] => Array ([0] => /var/www/vhosts/.../httpdocs/forum/newthread.php),[function] => require))),[code] => 256)) #1 trigger_error(Invalid JSON-response on line 196 in /var/www/vhosts/.../httpdocs/forum/bitly.php , 256) called at [/var/www/vhosts/.../httpdocs/forum/vb/vb.php:284] #2 vB::handleException(BitlyException Object ([] => Invalid JSON-response,[] => ,[] => 0,[] => /var/www/vhosts/.../httpdocs/forum/bitly.php,[] => 196,[] => Array ([0] => Array ([file] => /var/www/vhosts/.../httpdocs/forum/bitly.php,[line] => 382,[function] => doCall,[class] => Bitly,[type] => ->,[args] => Array ([0] => shorten,[1] => Array ([longUrl] => http://www..../forum/showthread.php?t=5559,[history] => 1))),[1] => Array ([file] => /var/www/vhosts/.../httpdocs/forum/newthread.php(262) : eval()'d code,[line] => 12,[function] => shorten,[class] => Bitly,[type] => ->,[args] => Array ([0] => http://www..../forum/showthread.php?t=5559)),[2] => Array ([file] => /var/www/vhosts/.../httpdocs/forum/newthread.php,[line] => 262,[function] => eval),[3] => Array ([file] => /var/www/vhosts/.../httpdocs/forum/vbseo.php,[line] => 1621,[args] => Array ([0] => /var/www/vhosts/.../httpdocs/forum/newthread.php),[function] => require))))
buro9
01-28-2010, 02:04 PM
Getting 500 internal server error, any ideas?
Nope... you must have made a syntax error.
This mod is all great and I love the idea, never thought of it... but..
How exactly is it helping you get visitors to your site from those viewing your twitter page? I mean...all those threads that are relayed to twitter to be posted have no link backs to your actual vbulletin site, do they? Correct me if I'm wrong.
But if it just copies threads/posts and posts it on tweeter without some sort of link back to original thread... then what's the use?
Again, correct me if I'm wrong.
And thanks for the mod!
Bit.ly is being used to make sure your URLs don't break the 140 chars limit for the whole message. A prefix could take 10 chars, a thread title up to 85, leaving you with 45 chars for the URL, 43 if you substract 2 spaces... so to ensure that the URL fits I shorten it.
Bit.ly redirects traffic to the shortened URL to your site. And bit.ly keeps stats of this, so you get stats on who is clicking through as a result of twitter.
I have the same error
The authentication error is a result of not following the instructions.
Note tazattitude's post:
the bitly should look like this (example)
$bitly = new Bitly('testUser', 'R_hj3456hgf3hig56hi2gf6');
not $bitly = new Bitly('<testUser>', '<R_hj3456hgf3hig56hi2gf6>');
buro9
01-28-2010, 02:08 PM
When I post a new thread I get the following error:
Flep, you're seeing the same issue as Nordinho, though I have no idea why it happens.
It's basically that PHP provides a built-in function called json_decode. That is failing even though the JSON from bit.ly is valid. I don't know why it's failing for you guys and not anyone else.
Feel free to comment out the bit.ly part of the plugin if the length of your thread URL's is below 43 chars (which is likely). The only part you'd lose as a result is stats from bit.ly about how many people clicked each link.
It seems so indeed, commented out the json errors and it posts to twitter (obviously not the shortened url though)
Nordinho... still can't help except to advise that you skip the URL shortening if your URLs are always going to be below 43 chars in length.
Can't for the life of me see why json_decode is failing as it's a built-in function. I'm on PHP 5.10 but it's not like I believe that json_decode wasn't working properly in any of the v5 branch.
cagbaazee
01-28-2010, 02:11 PM
i I hv make change again but nothing is working..
here is my code please check whether it is working or not.
// The array below are the ids of non-public forums, update these to be your admin forum ids or anything non-public by default
$excludedForums = array(0);
if (!in_array($foruminfo[forumid], $excludedForums)) {
// http://classes.verkoyen.eu/bitly
require_once 'bitly.php';
// http://classes.verkoyen.eu/twitter/
require_once 'twitter.php';
$bitly = new Bitly('guru', 'R_5e3b37532588ecb8603c0f14b5b75cbz');
$shortUrl = $bitly->shorten('http://www.guru.info/forum/showthread.php?t='.$newpost[threadid]);
$tweet = '';
if (isset($newpost['prefixid']) && $newpost['prefixid'] != '') {
$tweet = $vbphrase['prefix_'.$newpost['prefixid'].'_title_plain'].' ';
}
$tweet .= $newpost['title'].' '.$shortUrl;
$twitter = new Twitter('guru','jimmy');
$twitter->updateStatus($tweet);
}
=================================================
// The array below are the ids of non-public forums, update these to be your admin forum ids or anything non-public by default
$excludedForums = array(0);
if (!in_array($foruminfo[forumid], $excludedForums)) {
// http://classes.verkoyen.eu/bitly
require_once 'bitly.php';
// http://classes.verkoyen.eu/twitter/
require_once 'twitter.php';
$bitly = new Bitly('wadhera69@hotmail.com', 'R_5e3b37532588ecb8603c0f14b5b75cbz');
$shortUrl = $bitly->shorten('http://www.guru.info/forum/showthread.php?t='.$newpost[threadid]);
$tweet = '';
if (isset($newpost['prefixid']) && $newpost['prefixid'] != '') {
$tweet = $vbphrase['prefix_'.$newpost['prefixid'].'_title_plain'].' ';
}
$tweet .= $newpost['title'].' '.$shortUrl;
$twitter = new Twitter('guru','jimmy');
$twitter->updateStatus($tweet);
}
==================
please confirm what is correct code for that. what is array stand for .. it mean that i donot hv to show my forum id or thread to public.. Right
Do reply
buro9
01-28-2010, 02:13 PM
The first one looks correct, the second on is wrong.
bit.ly expects your username (not email) and your api key.
I wouldn't be posting either your API key or passwords on here btw... that's kinda silly.
buro9
01-28-2010, 02:14 PM
what is array stand for .. it mean that i donot hv to show my forum id or thread to public.. Right
The array EXCLUDES forums.
Hence it being called $excludedForums.
So if you have admin forums, or other non-public forums, you can prevent these from being tweeted.
Simples.
Explanation is in the instructions.
cagbaazee
01-28-2010, 02:16 PM
The first one looks correct, the second on is wrong.
bit.ly expects your username (not email) and your api key.
I wouldn't be posting either your API key or passwords on here btw... that's kinda silly.
i know that it is fake api and fake username / password.
But u didnot answer my question -
"please confirm what is correct code for that. what is array stand for .. it mean that i donot hv to show my forum id or thread to public.. Right
Do reply"
buro9
01-28-2010, 02:24 PM
But u didnot answer my question -
"please confirm what is correct code for that. what is array stand for .. it mean that i donot hv to show my forum id or thread to public.. Right
Do reply"
Post #56 answers it, and an example is in the instructions:
You also should make a list of the forumIds that are non-public as you will want to put these in the array provided.
i.e. if your admin forum is forumId = 7 and you also have a private forum for regular members which is forumid = 12, then you will want this:
$excludedForums = array(7, 12);
So in that example any new threads that are started within forum 7 or forum 12 won't be tweeted.
Does this not make sense?
buro9
01-28-2010, 02:26 PM
@Nordinho and @Flep
I've updated the instructions so that disabling bitly and using the long version of the URL is trivial.
Just set $useBitly = false; where it is currently true.
cagbaazee
01-28-2010, 02:43 PM
Post #56 answers it, and an example is in the instructions:
So in that example any new threads that are started within forum 7 or forum 12 won't be tweeted.
Does this not make sense?
Thanks.. if what i donot make wanna to make array.. so deafult (0) so all forumid will display. Right. Do reply
buro9
01-28-2010, 02:45 PM
Thanks.. if what i donot make wanna to make array.. so deafult (0) so all forumid will display. Right. Do reply
Precisely.
There is no way that you have a forum in the database with the id of zero... so nothing is excluded by default.
But if you do want to exclude, just build that array with the id's of the forums you want to exclude.
Bouncer222
01-28-2010, 03:05 PM
This mod is all great and I love the idea, never thought of it... but..
How exactly is it helping you get visitors to your site from those viewing your twitter page? I mean...all those threads that are relayed to twitter to be posted have no link backs to your actual vbulletin site, do they? Correct me if I'm wrong.
But if it just copies threads/posts and posts it on tweeter without some sort of link back to original thread... then what's the use?
Again, correct me if I'm wrong.
And thanks for the mod!
Anyone?
@Nordinho and @Flep
I've updated the instructions so that disabling bitly and using the long version of the URL is trivial.
Just set $useBitly = false; where it is currently true.
Done, but now I get the following:
/statuses/update.xml Could not authenticate you. Unauthorized on line 229 in /var/www/vhosts/.../httpdocs/forum/twitter.php
#0 /var/www/vhosts/.../httpdocs/forum/twitter.php(648): Twitter->doCall('statuses/update...', Array, true)
#1 /var/www/vhosts/.../httpdocs/forum/newthread.php(262) : eval()'d code(26): Twitter->updateStatus('testing twitter thread...')
#2 /var/www/vhosts/.../httpdocs/forum/newthread.php(262): eval()
#3 /var/www/vhosts/.../httpdocs/forum/vbseo.php(1621): require('/var/www/vhosts...')
#4 {main}
Can it be vbSEO ?
buro9
01-28-2010, 03:16 PM
Anyone?
Answered in post 52.
https://vborg.vbsupport.ru/showpost.php?p=1968963&postcount=52
Not that you have to use bit.ly, but it helps. And Google follows the bit.ly 301's so you do earn the links in my understanding.
Done, but now I get the following:
/statuses/update.xml Could not authenticate you. Unauthorized on line 229 in /var/www/vhosts/.../httpdocs/forum/twitter.php
#0 /var/www/vhosts/.../httpdocs/forum/twitter.php(648): Twitter->doCall('statuses/update...', Array, true)
#1 /var/www/vhosts/.../httpdocs/forum/newthread.php(262) : eval()'d code(26): Twitter->updateStatus('testing twitter thread...')
#2 /var/www/vhosts/.../httpdocs/forum/newthread.php(262): eval()
#3 /var/www/vhosts/.../httpdocs/forum/vbseo.php(1621): require('/var/www/vhosts...')
#4 {main}
Can it be vbSEO ?
It's not vbseo, I use it as do a few others.
Have you got a phpinfo link? (PM me). I won't be able to look at it right now as I'm heading out shortly but I can take a look tomorrow.
buro9
01-28-2010, 03:22 PM
@Flep... I've got it:
http://www.php.net/ChangeLog-4.php
"Disabled CURLOPT_FOLLOWLOCATION in curl when open_basedir or safe_mode are enabled." as of PHP 4.4.4/5.1.5."
You're on a shared host aren't you? And either safe_mode is on or open_basedir is enabled.
There is a hack around it:
http://php.net/manual/ro/function.curl-setopt.php#71313
But it's beyond the scope of what I've done to be able to include this (I don't suffer the problem so cannot reproduce it to test any fixes).
If you're comfortable hacking and do figure the solution out using that as a starting point then if you let me know what you've done I'll update the hack to take it into account.
Answered in post 52.
https://vborg.vbsupport.ru/showpost.php?p=1968963&postcount=52
Not that you have to use bit.ly, but it helps. And Google follows the bit.ly 301's so you do earn the links in my understanding.
It's not vbseo, I use it as do a few others.
Have you got a phpinfo link? (PM me). I won't be able to look at it right now as I'm heading out shortly but I can take a look tomorrow.
Here I have
'./configure' '--build=i386-redhat-linux-gnu' '--host=i386-redhat-linux-gnu' '--target=i386-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-libdir=lib' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--disable-debug' '--with-pic' '--disable-rpath' '--without-pear' '--with-bz2' '--with-curl' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-png' '--with-pspell' '--with-expat-dir=/usr' '--with-pcre-regex=/usr' '--with-zlib' '--with-layout=GNU' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-track-vars' '--enable-trans-sid' '--enable-yp' '--enable-wddx' '--with-kerberos' '--enable-ucd-snmp-hack' '--with-unixODBC=shared,/usr' '--enable-memory-limit' '--enable-shmop' '--enable-calendar' '--enable-dbx' '--enable-dio' '--without-mime-magic' '--without-sqlite' '--with-libxml-dir=/usr' '--with-xml' '--with-apxs2=/usr/sbin/apxs' '--without-mysql' '--without-gd' '--without-odbc' '--disable-dom' '--disable-dba' '--without-unixODBC' '--disable-pdo' '--disable-xmlreader' '--disable-xmlwriter' '--disable-json'
Do you think that is the problem ?
@Flep... I've got it:
http://www.php.net/ChangeLog-4.php
"Disabled CURLOPT_FOLLOWLOCATION in curl when open_basedir or safe_mode are enabled." as of PHP 4.4.4/5.1.5."
You're on a shared host aren't you? And either safe_mode is on or open_basedir is enabled.
There is a hack around it:
http://php.net/manual/ro/function.curl-setopt.php#71313
But it's beyond the scope of what I've done to be able to include this (I don't suffer the problem so cannot reproduce it to test any fixes).
If you're comfortable hacking and do figure the solution out using that as a starting point then if you let me know what you've done I'll update the hack to take it into account.
I'm on dedicated server.
safe_mode is off.
open_basedir is "no value".
I'll try to find a solution, thank you for your help !
buro9
01-28-2010, 03:35 PM
Here I have
'./configure' '--build=i386-redhat-linux-gnu' '--host=i386-redhat-linux-gnu' '--target=i386-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-libdir=lib' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--disable-debug' '--with-pic' '--disable-rpath' '--without-pear' '--with-bz2' '--with-curl' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-png' '--with-pspell' '--with-expat-dir=/usr' '--with-pcre-regex=/usr' '--with-zlib' '--with-layout=GNU' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-track-vars' '--enable-trans-sid' '--enable-yp' '--enable-wddx' '--with-kerberos' '--enable-ucd-snmp-hack' '--with-unixODBC=shared,/usr' '--enable-memory-limit' '--enable-shmop' '--enable-calendar' '--enable-dbx' '--enable-dio' '--without-mime-magic' '--without-sqlite' '--with-libxml-dir=/usr' '--with-xml' '--with-apxs2=/usr/sbin/apxs' '--without-mysql' '--without-gd' '--without-odbc' '--disable-dom' '--disable-dba' '--without-unixODBC' '--disable-pdo' '--disable-xmlreader' '--disable-xmlwriter' '--disable-json'
Do you think that is the problem ?
That certainly looks extremely promising.
Indeed, on my server json support is enabled.
SJ073
01-28-2010, 04:03 PM
I am seeing this error:
Fatal error: Call to undefined function curl_init() in bitly.php on line 138
ANy Ideas of where to start looking?
Moondust
01-28-2010, 04:30 PM
oh... verry hard.... i have no delete the < > in Username etc....
Now.... it WORK !
Nordinho
01-28-2010, 05:17 PM
@Nordinho and @Flep
I've updated the instructions so that disabling bitly and using the long version of the URL is trivial.
Just set $useBitly = false; where it is currently true.
Thanks, tried it, getting this error as well (allthough the thread gets posted on twitter)
Fatal error: Uncaught exception 'TwitterException' with message 'invalid body' in /home/dir/twitter.php:662 Stack trace: #0 /home/dir/newthread.php(271) : eval()'d code(28): Twitter->updateStatus('yrdyasdfsadfsgs...') #1 /home/dir/newthread.php(271): eval() #2 {main} thrown in /home/dir/twitter.php on line 662
That certainly looks extremely promising.
Indeed, on my server json support is enabled.
It seems to be enabled on mine. Maybe I have an outdated version?
json support enabled
json version 1.2.1
I'm using vBSEO, 4.0.1 and here is what I have set up, receiving a 500 Internal Error, but thread is being posted. I have the two files in my forum root (which is www.uscoininfo.com). edit: using IIS6. Ideas?
Hook Location: newthread_post_complete
// The array below are the ids of non-public forums, update these to be your admin forum ids or anything non-public by default
$excludedForums = array(0);
// If you are having trouble getting bitly URL shortening to work... disable it!
$useBitly = true;
if (!in_array($foruminfo[forumid], $excludedForums)) {
$shortUrl = 'http://www.uscoininfo.com/showthread.php?t='.$newpost[threadid];
if ($useBitly) {
// http://classes.verkoyen.eu/bitly
require_once 'bitly.php';
$bitly = new Bitly('uscoininfo', 'mykey');
$shortUrl = $bitly->shorten($shortUrl);
}
$tweet = '';
if (isset($newpost['prefixid']) && $newpost['prefixid'] != '') {
$tweet = $vbphrase['prefix_'.$newpost['prefixid'].'_title_plain'].' ';
}
$tweet .= $newpost['title'].' '.$shortUrl;
// http://classes.verkoyen.eu/twitter/
require_once 'twitter.php';
$twitter = new Twitter('uscoininfo','mypassword');
$twitter->updateStatus($tweet);
}
Bouncer222
01-28-2010, 06:36 PM
One big REQUEST...
Is it possible to implement into this addon so that once we install it, we can have the option to tweet all old threads/posts etc.. onto twitter.com that were made before this installation? AND.. having the option to delay each tweet so that the site doesn't slow down or anything.
Also it seems it is not working for me and I put in all the stuff in the php code...
I made a test thread http://www.brotherhoodofgamers.com/general-forum/205-test-thread-will-deleted.html#post696
and it doesnt show up on my twitter at: http://twitter.com/bogbouncer1
What I edited:
bit.ly username and inserted API ( I did not include the < > anywhere, I removed those as well as the instructions say to)
I put in my twitter username and pass, changed yourforumsdomain.com to www.brotherhoodofgamers.com
Did I miss anything? I also uploaded files to root from the author's post, NOT from the 2 links it says to, since I believe it says I can just download it from here. correct me if I'm wrong or missed anything, thanks
buro9
01-28-2010, 08:40 PM
I am seeing this error:
Fatal error: Call to undefined function curl_init() in bitly.php on line 138
ANy Ideas of where to start looking?
Looks like you don't have CURL installed as a module in your PHP installation.
oh... verry hard.... i have no delete the < > in Username etc....
Now.... it WORK !
Brilliant.
If it's working, wrap it in a try {} catch {} and silence the beast. ;)
Perhaps not the most scientific approach but the library and twitter itself aren't my speciality.
[quote=Jesh;1969176]I'm using vBSEO, 4.0.1 and here is what I have set up, receiving a 500 Internal Error, but thread is being posted. I have the two files in my forum root (which is www.uscoininfo.com (http://www.uscoininfo.com)). edit: using IIS6. Ideas?
Your config is correct, so it's not that.
Can you check that JSON is enabled in PHP and that you have the CURL extension installed.
One big REQUEST...
Is it possible to implement into this addon so that once we install it, we can have the option to tweet all old threads/posts etc.. onto twitter.com that were made before this installation? AND.. having the option to delay each tweet so that the site doesn't slow down or anything.
Also it seems it is not working for me and I put in all the stuff in the php code...
I made a test thread http://www.brotherhoodofgamers.com/general-forum/205-test-thread-will-deleted.html#post696
and it doesnt show up on my twitter at: http://twitter.com/bogbouncer1
What I edited:
bit.ly username and inserted API ( I did not include the < > anywhere, I removed those as well as the instructions say to)
I put in my twitter username and pass, changed yourforumsdomain.com to www.brotherhoodofgamers.com (http://www.brotherhoodofgamers.com)
Did I miss anything? I also uploaded files to root from the author's post, NOT from the 2 links it says to, since I believe it says I can just download it from here. correct me if I'm wrong or missed anything, thanks
You got everything, it should be working. (though I realise it's not).
As for the add-on. There's little value in going back over old threads, for starters twitter rate limits the posting. And even if that didn't the point is to drive search engines and people to fresh content, the rest they discover as time goes on.
It would be nice to wrap it up as a vbulletin product so that all of this config that seems to be causing people trouble could be put into a HTML form where people seem fine with such things... and perhaps to perform tests for CURL and JSON during install to validate that their server meet the pre-reqs for the libraries.
Issue is, I have no experience in building vb products... I just hack my forums and when I have a small gem that helps I share it with the world. If anyone else wants to wrap it up in a lovely product, then I'm happy to make you a co-author thingy and to publish it.
SJ073
01-28-2010, 08:40 PM
I am seeing this error:
Fatal error: Call to undefined function curl_init() in bitly.php on line 138
ANy Ideas of where to start looking?
Fixed! Help to have cURL enabled :)
Great Mod - Installed and Voted!
Bouncer222
01-28-2010, 09:18 PM
This is sad... it won't work... I'm pretty sure I did everything it says..
Anyone?
buro9
01-28-2010, 09:29 PM
This is sad... it won't work... I'm pretty sure I did everything it says..
Anyone?
Feel free to PM me your plugin PHP and I'll take a look.
Do you not get any errors at all visible?
I dont have cURL installed, doh. Will install tomorrow and let you know if that solves the 500 internal errors.
My problem (500 Internal Error)
Solved
Issue: cURL not installed, Windows Server 2003 / IIS6
Thanks for the info buro!
blake247
01-29-2010, 05:42 AM
cagbaazee - I did the same thing you did, I left the " < " and the " > " in there. Remove those and it should work as long as you have your un, pw, and the key correct
the bitly should look like this (example)
$bitly = new Bitly('testUser', 'R_hj3456hgf3hig56hi2gf6');
not $bitly = new Bitly('<testUser>', '<R_hj3456hgf3hig56hi2gf6>');
same with the twitter line
Thanks! That fixed my problem :up:
@ buro9
I fixed it.
I am using the following classes:
http://code.google.com/p/bitly/
http://twitter.slawcup.com/twitter.class.phps
My vbulletin plugin becomes:
$excludedForums = array(0);
if (!in_array($foruminfo[forumid], $excludedForums)) {
$shortUrl = 'http://www.yourforumsdomain.com/showthread.php?t='.$newpost[threadid];
include 'BitLy.php';
$bitly = new Bitly('<bit.ly username>', '<bit.ly API key>');
$shortUrl = $bitly->shortenSingle($shortUrl);
$tweet = '';
if (isset($newpost['prefixid']) && $newpost['prefixid'] != '') {
$tweet = $vbphrase['prefix_'.$newpost['prefixid'].'_title_plain'].' ';
}
$tweet .= $newpost['title'].' '.$shortUrl;
include 'twitter.php';
$t= new twitter();
$t->username='twitter username';
$t->password='twitter password';
$t->update($tweet);
}
Athena1984
01-29-2010, 12:06 PM
I am not getting any errors but I am not getting any updates either. I'm sure I've done everything according to the instructions.
cagbaazee
01-29-2010, 01:16 PM
Sorry .. too bad.. it doesnot works, after i follow the instruction..
pepsicola38
01-29-2010, 02:30 PM
This sounds cool I will try it out tomorrow (too tired now.) Is it possible to have it tweet blog and/or cms articles also? or only threads? Either way I will try it out tomorrow!
Moondust
01-29-2010, 04:40 PM
We can only feed new threads..... bu we can we feed answers in Threads ?
I am not getting any errors but I am not getting any updates either. I'm sure I've done everything according to the instructions.
I had the same issue, was missing a closing } at the end, did not copy/paste correctly from the code. I'm surprised it didnt give me an error with the statement not being closed.
I have attached the error I am receiving after posting a thread. The thread posts correctly but does not send to twitter. Any advice?
tobe12
01-29-2010, 10:36 PM
I am getting the following error after posting a new thread:
Fatal error: Call to undefined function curl_init() in /home/ddddd/public_html/forums/bitly.php on line 145
zachsg
01-29-2010, 10:51 PM
I had the same issue, was missing a closing } at the end, did not copy/paste correctly from the code. I'm surprised it didnt give me an error with the statement not being closed.
I fixed my issue as well, though my problem was I didn't comment out the description at the top. Commented that out and it works amazingly.
Thanks!
Videx
01-30-2010, 01:52 AM
Well, I swear I've been over my code 10 times with a fine tooth code-comb and it's fine. And I even had bit.ly reset my API. But I'm still getting the auth errors "You must be authenticated to access shorten on line 193 in ...".
I can disable bit.ly and the twitter stuff works.
I wonder: Can I simply exclude my Admin category number, rather than excluding each separate forum under it (moderators, super moderators, etc.)?
edit: No, you cannot exclude categories. You must list each separate forum.
imported_nimbus
01-30-2010, 03:08 AM
Let me share my solution.
bitly.php:
I set the following Curl options:
$options[CURLOPT_FOLLOWLOCATION] = false;
$options[CURLOPT_HEADER] = false;
and for twitter.php:
$options[CURLOPT_FOLLOWLOCATION] = false;
Then all error messages gone! :)
This tool is insane, I get 500+ Guests after every thread is posted woha!! thanks man
Athena1984
01-30-2010, 06:35 AM
I had the same issue, was missing a closing } at the end, did not copy/paste correctly from the code. I'm surprised it didnt give me an error with the statement not being closed.
Oh, it works now! Thanks Jesh!:)
murekhalir
01-30-2010, 06:40 AM
This is SEXY.
tobe12
01-30-2010, 08:28 AM
I enabled CURL in Apache, and now this Mod is working for be . Thank you very much.
buro9
01-30-2010, 08:49 AM
What fun getting this stuff working.
So it all seems to boil down to making sure:
1) CURL is installed and enabled for PHP
2) JSON is enabled
3) You've put the right values in the plugin
4) The moon cycle is aligned with mars
Works a dream once you get past your environment's issues though.
I'm still looking for someone to help package this if people would like that.
Outstanding! Thank you.
I had no problems whatsoever in making this work...however, I did take a little bit of time to figure out what needed to be inserted into the plugin code. To save anyone else the extra few minutes, you are basically just replacing the info in between the < > symbols.
Videx
01-30-2010, 12:34 PM
To save anyone else the extra few minutes, you are basically just replacing the info in between the < > symbols.Uh no. You're supposed to replace the <> symbols AND everything between them.
PS I am not seeing any sort of influx of guests; certainly not 500. But then we've never had a presence and have few followers. Not sure what we could do with 500 lurkers knocking about anyway.
lovechandigarh
01-30-2010, 12:42 PM
Great! Working at http://twitter.com/love_punjab for http://www.lovepunjab.com
Nordinho
01-30-2010, 02:55 PM
4) The moon cycle is aligned with mars
Damn, forgot that ;)
lovechandigarh
01-30-2010, 03:57 PM
Great! Working at http://twitter.com/love_punjab for http://www.lovepunjab.com
Installed it on another of my sites www.lovechandigarh.com working on vb 3.x.
Thanks again... Appreciated!
Alibass
01-30-2010, 11:22 PM
Let me share my solution.
bitly.php:
I set the following Curl options:
$options[CURLOPT_FOLLOWLOCATION] = false;
$options[CURLOPT_HEADER] = false;
and for twitter.php:
$options[CURLOPT_FOLLOWLOCATION] = false;
Then all error messages gone! :)
Mate this done the trick for me. Mine is working as it should be now. Thanks for posting. :)
Alibass
01-30-2010, 11:34 PM
@buro9
Fantastic mod mate and thanks for sharing. It's really bringing in the traffic! :D
This tool is insane, I get 500+ Guests after every thread is posted woha!! thanks man
I didn't see an increase, but my site is very new. I got about 20 spiders hit me at once though.
Bouncer222
01-31-2010, 04:02 AM
Feel free to PM me your plugin PHP and I'll take a look.
Do you not get any errors at all visible?
Here is my php.. what did I do wrong?
// The array below are the ids of non-public forums, update these to be your admin forum ids or anything non-public by default
$excludedForums = array(0);
// If you are having trouble getting bitly URL shortening to work... disable it!
$useBitly = true;
if (!in_array($foruminfo[forumid], $excludedForums)) {
$shortUrl = 'http://www.brotherhoodofgamers.com/showthread.php?t='.$newpost[threadid];
if ($useBitly) {
// http://classes.verkoyen.eu/bitly
require_once 'bitly.php';
$bitly = new Bitly('bouncer', 'API KEY');
$shortUrl = $bitly->shorten($shortUrl);
}
$tweet = '';
if (isset($newpost['prefixid']) && $newpost['prefixid'] != '') {
$tweet = $vbphrase['prefix_'.$newpost['prefixid'].'_title_plain'].' ';
}
$tweet .= $newpost['title'].' '.$shortUrl;
// http://classes.verkoyen.eu/twitter/
require_once 'twitter.php';
$twitter = new Twitter('bogbouncer1','passwordhere');
$twitter->updateStatus($tweet);
}
Please someone help me :)
You've got a space at the end of your bit.ly key (which you might want to remove from the code block here..)
Videx
01-31-2010, 04:14 AM
I don't remember your specific problem, but I see you have the infamous extra space after your bitly API.
However, I still can't get bit.ly to authenticate me regardless.
Bouncer222
01-31-2010, 04:21 AM
I fixed it, and now my host enabled CURL, JSON is enabled as well.. did I miss something??
EDIT: It still wont work.
Bouncer222
01-31-2010, 04:41 AM
K it works, thanks to all who helped!
EDIT: wow and the second I go back to my home page, my spiders on my site went from 11 to 22 and growing...nice!
Uh no. You're supposed to replace the <> symbols AND everything between them.
PS I am not seeing any sort of influx of guests; certainly not 500. But then we've never had a presence and have few followers. Not sure what we could do with 500 lurkers knocking about anyway.
Okay, let's play semantics. What are you "replacing" the <> symbols with? If it is nothing, then that is not replacing them, it is deleting them AND replacing the info in between them.
Don't know why this would warrant a snarky comment from you and, even more, one that takes exception to the post and then seeks to correct it with....wait for it....an equally incorrect statement.
iguano
01-31-2010, 09:50 AM
It works but when i go on twitter i see "unknow file"and when i click on the link come out 404 Not Found
( Not Found
The requested URL /showthread.php was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.)
cagbaazee
01-31-2010, 01:35 PM
With due regards I would like to bring to your kind notice and would like
to have your kind favour in solving my problem.
1. When some one post it immediately goes to twitter site and by clicking
on it - it displays "No Thread specified. If you followed a valid link,
please notify the administrator."
2.Secondly, When somebody adds new thread, it doesnot appears, but when he add it twice then it appear.
3. When someone post it , but it doesnot mention the name of title at bid.ly, it only mention gs community
I, therefore, like to have your kind favour to get it solved as soon as
possible as I need the "TITLE" to be displayed. Kindly guide me in this
matter.
Regards
copy of screenshot here
buro9
01-31-2010, 01:40 PM
It works but when i go on twitter i see "unknow file"and when i click on the link come out 404 Not Found
( Not Found
The requested URL /showthread.php was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.)
Do you have your forums in a different folder? Did you adjust the URL to match your forums?
With due regards I would like to bring to your kind notice and would like
to have your kind favour in solving my problem.
1. When some one post it immediately goes to twitter site and by clicking
on it - it displays "No Thread specified. If you followed a valid link,
please notify the administrator."
2.Secondly, When somebody adds new thread, it doesnot appears, but when he add it twice then it appear.
3. When someone post it , but it doesnot mention the name of title at bid.ly, it only mention gs community
I, therefore, like to have your kind favour to get it solved as soon as
possible as I need the "TITLE" to be displayed. Kindly guide me in this
matter.
Regards
copy of screenshot here
1) Do you have your forums in your forum root? Did you adjust the URL to match your site?
2) There's no reason for it to be called twice, the plugin will either work all the time, or fail all the time. Please double-check the instructions.
3) Twitter will show precisely what you tell it to, bit.ly statistics on the other hand will go and fetch the page and will show the title of the page it fetched. So in the case of bit.ly it is resolving and fetching the URL and show the title of that page. You've already said that problem #1 is that you get a 404 not found, which suggests that your URL is wrong. bit.ly is showing the title of your 404 page because that's currently where the URL ends. Fix #1 and #3 will also be fixed.
cagbaazee
01-31-2010, 01:47 PM
No i donot any other forum at my site , just one forum.
2. can u tell how to fix it #1 & #3.. do i hv install and follow the instruction again.
Do reply
Thanks
Do you have your forums in a different folder? Did you adjust the URL to match your forums?
1) Do you have your forums in your forum root? Did you adjust the URL to match your site?
2) There's no reason for it to be called twice, the plugin will either work all the time, or fail all the time. Please double-check the instructions.
3) Twitter will show precisely what you tell it to, bit.ly statistics on the other hand will go and fetch the page and will show the title of the page it fetched. So in the case of bit.ly it is resolving and fetching the URL and show the title of that page. You've already said that problem #1 is that you get a 404 not found, which suggests that your URL is wrong. bit.ly is showing the title of your 404 page because that's currently where the URL ends. Fix #1 and #3 will also be fixed.
buro9
01-31-2010, 01:54 PM
See this bit:
$shortUrl = 'http://www.yourforumsdomain.com/showthread.php?t='.$newpost[threadid];I'm pretty sure you've set it to:
$shortUrl = 'http://www.gurusecret.info/showthread.php?t='.$newpost[threadid];When it should be:
$shortUrl = 'http://www.gurusecret.info/vbforum/showthread.php?t='.$newpost[threadid];
Assuming I've googled correctly and that is your site.
cagbaazee
01-31-2010, 02:20 PM
here is my config..
// The array below are the ids of non-public forums, update these to be your admin forum ids or anything non-public by default
$excludedForums = array(7);
if (!in_array($foruminfo[forumid], $excludedForums)) {
// http://classes.verkoyen.eu/bitly
require_once 'bitly.php';
// http://classes.verkoyen.eu/twitter/
require_once 'twitter.php';
$bitly = new Bitly('guru', 'R_d3383e27ad33b187a20e78d68c063be');
$shortUrl = $bitly->shorten('http://www.mysite.info/vbforum/showthread.php?t='.$newpost[threadid]);
$tweet = '';
if (isset($newpost['prefixid']) && $newpost['prefixid'] != '') {
$tweet = $vbphrase['prefix_'.$newpost['prefixid'].'_title_plain'].' ';
}
$tweet .= $newpost['title'].' '.$shortUrl;
$twitter = new Twitter('guru','mypassword');
$twitter->updateStatus($tweet);
}
please check whether is it okay or not
If it s okay.. but i didnot make any change on it . it is same config what i do.
or if it is wrong then please explain correct config.
Do reply
tenjinzan
02-01-2010, 12:40 PM
Got it working perfectly first try. I read through the comments here, but I didn't see it (I may have missed, so forgive me if I did). Is there a way to include the Poster's name in the tweet? I'm not sure what the syntax would be for the tweet line.
Basically, I just want it to say "Thread name" by "Poster" ... bit.ly/url I can see WHERE to put it, but I'm not sure of the variable that refers to the poster of a thread.
tobe12
02-01-2010, 06:45 PM
Is there a way to make it tweet RSS feeds as well?
nextslit
02-04-2010, 02:01 AM
I would like to thank you for this great mod buro9 , realy nice try : )
and working perfect in 4.0.1
Videx
02-04-2010, 02:26 AM
Not working with the new BBR - vB Event Forums (https://vborg.vbsupport.ru/showthread.php?t=234794). Posting an event doesn't tweet the event. :(
TroyTrojansFan
02-04-2010, 03:08 AM
I've followed the instructions I believe and have installed everything, but new threads aren't being posted at Twitter. I don't get any error messages on the forums or at Twitter. :confused:
I saw that buro9 told someone they could PM him their PHP info so I'm going to do that and see if I might have messed up the syntax.
Thank you for your help, looking forward to getting this fix and running with it. :D
ChopSuey
02-04-2010, 07:59 AM
Wow you are the bomb! Is there a way to get some of the words from the new thread? Just installed, http://forum.vbdiscussions.com - http://twitter.com/vbdiscussions
It doesn't work with vBSEO enabled with custom URL structure, any solution?
TroyTrojansFan
02-04-2010, 09:38 PM
It doesn't work with vBSEO enabled with custom URL structure, any solution?
Seems it's not working with the new vbseo for me either. :confused:
I have tried to replace this string:
http://www.yourforumsdomain.com/showthread.php?t='.$newpost[threadid]
with my own custom URL string but without success, it doesn't work.
TroyTrojansFan
02-04-2010, 11:16 PM
I have tried to replace this string:
http://www.yourforumsdomain.com/showthread.php?t='.$newpost[threadid]
with my own custom URL string but without success, it doesn't work.
Yeah, the "showthread.php?t=" is not what shows up in a thread listing page URL when you use vbseo 3.5, so I mentioned to buro9 that might be the problem. But I have no clue. I'm not getting any error messages when I make a thread nor do I see any on the Twitter page. It just looks like nothing is happening. I asked my host and they said that CURL and JSON were enabled as well. :confused:
Seems it's not working with the new vbseo for me either. :confused:
That is not true,It does work with VBSEO,I use 3.5 with VB 4.01
Works like Magic.
Installed and Nominated,Simplest and Complete.
I have used Milad version before ,but this rocks !!!,Thanks a million buro 9 ,For the last one Month I have frequent here looking for this.
newmomsforum
02-05-2010, 03:09 AM
Works great for me and I'm another new VBSEO user to :D - Thanks :)
Boko577
02-05-2010, 03:56 AM
Got the authenticated error, and yes, I put in ALL the details. I've checked over and over, and it's correct. Any ideas?
thisgeek
02-05-2010, 06:42 AM
Got it working perfectly first try. I read through the comments here, but I didn't see it (I may have missed, so forgive me if I did). Is there a way to include the Poster's name in the tweet? I'm not sure what the syntax would be for the tweet line.
Basically, I just want it to say "Thread name" by "Poster" ... bit.ly/url I can see WHERE to put it, but I'm not sure of the variable that refers to the poster of a thread.
I'd also like to do this - just not sure what variable to use (if it's available).
And thanks - mod works perfectly.
Solved! And now works great
I have used Hook: newtreply_post_complete instead to use Hook: newthread_post_complete
Chicken Racer
02-05-2010, 07:32 AM
worked great , after I spent an hour trying to fine those <> bits that I could not see in front of me ..lol
Chicken Racer
02-05-2010, 07:34 AM
Got the authenticated error, and yes, I put in ALL the details. I've checked over and over, and it's correct. Any ideas?
I thought that myself but it was just a simple entry error I made... look harder.
Yes it's frustrating as hell .. instructions supplied confused me a little.
Pm your code a I fresh set of eyes might see the problem
Videx
02-05-2010, 12:45 PM
Solved! And now works great
I have used Hook: newtreply_post_complete instead to use Hook: newthread_post_completeCan you expand on this a bit? What was solved? Is this a method of getting all the posts, not just a new thread? Where did you change this?
newmomsforum
02-05-2010, 11:46 PM
Can you expand on this a bit? What was solved? Is this a method of getting all the posts, not just a new thread? Where did you change this?
That's an option made available when originally setting up the plugin, if you edit your plugin you'll see a drop down box with hook references. You can select it from there :)
newmomsforum
02-05-2010, 11:53 PM
Hey all, although this is working really good for me For posts made by my members, I have a forum which is populated by an RSS feed and new posts made within this forum are not being posted.
I'm thinking that the hook isn't being activated as a user isn't physically clicking the submit post button in these instances. Any ideas?
Thanks
Mark
Videx
02-06-2010, 01:00 AM
Presumably, like my missing calendar entries, newthread_post_complete isn't being called. Which is why I was hoping you had found a better hook.
TroyTrojansFan
02-06-2010, 01:57 AM
That is not true,It does work with VBSEO,I use 3.5 with VB 4.01
Works like Magic.
Installed and Nominated,Simplest and Complete.
I have used Milad version before ,but this rocks !!!,Thanks a million buro 9 ,For the last one Month I have frequent here looking for this.
What string did you use for what I.am posted?
TroyTrojansFan
02-06-2010, 02:19 AM
I've got the plugin working now, but only because I disabled bit.ly url shortening. So, that might be the problem rather than the vbseo URLs. Anyone else only able to get the plugin to work if you disabled bit.ly?? :confused: I'd really like to be able to use the bit.ly URL shortening as we have some long news article titles from time to time.
Boko577
02-06-2010, 03:33 AM
I thought that myself but it was just a simple entry error I made... look harder.
Yes it's frustrating as hell .. instructions supplied confused me a little.
Pm your code a I fresh set of eyes might see the problem
Why would I pm you the code with my password and stuff in it? It's fine, I've looked over it like 10 times, no joke. There are no spaces, there are no ><, so what could be the problem?
imprezion
02-06-2010, 06:24 AM
Great stuff! installed and working beautifully!!
Chicken Racer
02-06-2010, 07:32 AM
Boko I'm not interested in your pass , if you thought about it you could add any rubbish in place of your private details.
Best of luck with your problem, maybe some one else might offer to help.
I've now installed it on four forums and runs like a charm.
Hey buro9 or any one, what do I need to edit to allow RSS feeds bot poster to work with the script?
I have some video sites that feed to forum and I would like for these to be added to tweet when they are posted by the feed bot.
Any help would be great!
kefallon
02-06-2010, 05:57 PM
tried all different ways get the following error
/statuses/update.xml Could not authenticate you. Unauthorized on line 229 in /var/www/vhosts/ionian-island.co.uk/httpdocs/forums/twitter.php
#0 /var/www/vhosts/ionian-island.co.uk/httpdocs/forums/twitter.php(648): Twitter->doCall('statuses/update...', Array, true)
#1 /var/www/vhosts/ionian-island.co.uk/httpdocs/forums/newthread.php(262) : eval()'d code(26): Twitter->updateStatus('test http://www...')
#2 /var/www/vhosts/ionian-island.co.uk/httpdocs/forums/newthread.php(262): eval()
#3 {main}
anyone know how to sort this...
Videx
02-06-2010, 06:04 PM
Could not authenticate you. Unauthorized on ... /twitter.phpUnauth errors are probably exactly that. Look into errors in your username and password for Twitter. Look earlier in the thread for some solutions people have found.
I am still unable to authenticate with bitly as well.
Boko577
02-06-2010, 06:58 PM
Oh well, screw this mod then if the person who made this doesn't even know what the problem with it is... Uninstalled.
Chicken Racer
02-06-2010, 10:50 PM
Unauth errors are probably exactly that. Look into errors in your username and password for Twitter. Look earlier in the thread for some solutions people have found.
I am still unable to authenticate with bitly as well.
Videx I know you most likely checked over a dozens times but I did to..frustrating.
Check that your have entered your bitfly API key correct and bitfly user name
Just replace the read txt with your User name and API key that bitfly generate
if ($useBitly) {
// http://classes.verkoyen.eu/bitly
require_once 'bitly.php';
$bitly = new Bitly('username', 'R_0d2dbc4294APIKEY054c303c8ac7');
$shortUrl = $bitly->shorten($shortUrl);
}
TroyTrojansFan
02-07-2010, 01:44 AM
This modifcation is working like a charm and the traffic has spiked, too!! :D Great job on this!! :up:
Chicken Racer
02-07-2010, 03:03 AM
Slight increase here , time will tell, approx 18 - 22 spiders hit the thread in just seconds when a new thread is posted. The sites could only benefit.
kefallon
02-07-2010, 06:10 AM
Double checked my twitter deatils at bitly and in PHP code all correct still getting following error message.
statuses/update.xml Could not authenticate you. Unauthorized on line 229 in /var/www/vhosts/ionian-island.co.uk/httpdocs/forums/twitter.php
#0 /var/www/vhosts/ionian-island.co.uk/httpdocs/forums/twitter.php(648): Twitter->doCall('statuses/update...', Array, true)
#1 /var/www/vhosts/ionian-island.co.uk/httpdocs/forums/newthread.php(262) : eval()'d code(26): Twitter->updateStatus('test http://www...')
#2 /var/www/vhosts/ionian-island.co.uk/httpdocs/forums/newthread.php(262): eval()
#3 {main}
Could not find anything in previous threads i was clever enough to understand! regarding this problem....
nekiw
02-07-2010, 07:18 AM
is it possible to make it work for only articles from CMS portal ?
buro9
02-07-2010, 07:33 AM
is it possible to make it work for only articles from CMS portal ?
Hey all, although this is working really good for me For posts made by my members, I have a forum which is populated by an RSS feed and new posts made within this forum are not being posted.
I'm thinking that the hook isn't being activated as a user isn't physically clicking the submit post button in these instances. Any ideas?
Thanks
Mark
Hey buro9 or any one, what do I need to edit to allow RSS feeds bot poster to work with the script?
I have some video sites that feed to forum and I would like for these to be added to tweet when they are posted by the feed bot.
Any help would be great!
You would need to identify which hook is in the script that vBulletin is using to consume the RSS. This usually just means opening the .php file that is used to consume the RSS and then reading the code and looking for a line that says "hook" anywhere on it, and within that is usually the name of the hook.
Once identified the plugin can be used there too, and looking above the hook line will reveal what variables are in use that you can use in the plugin.
If other people are willing to work that bit out (I don't use that functionality) then I'm happy to publish it here too and give you credit so that it all sits in one place and people can get all the bits they want.
Oh well, screw this mod then if the person who made this doesn't even know what the problem with it is... Uninstalled.
Apologies for not knowing jack about your server environment, software stack or configuration, etc.
I have provided a solution that works in a lot of instances and when it fails appears to be down to:
1) User details being wrong.
2) CURL not being installed.
3) JSON not being enabled.
4) Safe_Mode being used.
Check those things, you have knowledge of your environment (I hope) whereas I do not. Unfortunately I've not yet acquired the ability to telepathically converse with random servers around the world, but when I do I will sort your problems out for you.
Can you expand on this a bit? What was solved? Is this a method of getting all the posts, not just a new thread? Where did you change this?
It is the second step when you create the plugin, I had wrong to set the Hook, instead to choose Hook: newthread_post_complete, I had used Hook: replythread_post_complete.
Go to the plugin manager and create a new plugin with the following details:
Product: vBulletin
Hook: newthread_post_complete
Title: Tweet to Twitter
Uberguilds
02-07-2010, 02:01 PM
Oh well, screw this mod then if the person who made this doesn't even know what the problem with it is... Uninstalled.
Lol at that guy.
Is there a way to sneak in a re-tweat of popular threads every 24 hours or at a specific time frame? That would be extremely beneficial if it could be added in.
delmarva
02-07-2010, 09:18 PM
Double checked my twitter deatils at bitly and in PHP code all correct still getting following error message.
statuses/update.xml Could not authenticate you. Unauthorized on line 229 in /var/www/vhosts/ionian-island.co.uk/httpdocs/forums/twitter.php
#0 /var/www/vhosts/ionian-island.co.uk/httpdocs/forums/twitter.php(648): Twitter->doCall('statuses/update...', Array, true)
#1 /var/www/vhosts/ionian-island.co.uk/httpdocs/forums/newthread.php(262) : eval()'d code(26): Twitter->updateStatus('test http://www...')
#2 /var/www/vhosts/ionian-island.co.uk/httpdocs/forums/newthread.php(262): eval()
#3 {main}
Could not find anything in previous threads i was clever enough to understand! regarding this problem....
Same issue here... Looks like a great mod.
redhawk89
02-07-2010, 09:32 PM
Can this be made into a product?
Videx
02-08-2010, 12:37 AM
Same issue here... Looks like a great mod.This mod is doing what it's supposed to, but for some reason some servers are failing to authenticate with Twitter, others get past that and can't authenticate with bitly (like my shared server).
Perhaps someone with a dedicated server can check their error logs and see just what's going on?
Robru
02-08-2010, 02:18 PM
Perfect Mod, thanks !!! :)
sqzdog
02-08-2010, 03:56 PM
Is there a way to tweet new posts, instead of just new threads?
sqzdog
02-08-2010, 04:09 PM
I keep getting these SQL error emails from my server. Are these errors related to this plug-in??
Database error in vBulletin 4.0.1:
Invalid SQL:
SELECT thread.threadid, thread.title, thread.lastpost, thread.forumid, thread.replycount, thread.postusername, thread.postuserid, thread.lastposter, thread.lastposterid, thread.dateline, thread.views, thread.visible, thread.open, user.usergroupid, user.displaygroupid
FROM vbthread AS thread
LEFT JOIN vbuser AS user ON (user.userid = thread.lastposterid)
WHERE NOT ISNULL(thread.threadid) AND thread.visible = '1' AND thread.open!='10' AND thread.forumid NOT IN(34,33,51,52,59,24,47,48,49,50,8,35,11,12,13,14, 15,58,37,38,60,)
ORDER BY lastpost DESC
LIMIT 0, 15;
MySQL Error : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')
ORDER BY lastpost DESC
LIMIT 0, 15' at line 4
Error Number : 1064
Request Date : Saturday, February 6th 2010 @ 10:54:59 PM
Error Date : Saturday, February 6th 2010 @ 10:54:59 PM
Script : http://www.****.org/****/forums/forumdisplay.php?f=39
Referrer :
IP Address : 208.***.***.**
Username : Unregistered
Classname : vB_Database
MySQL Version :
TyPenn613
02-09-2010, 05:31 AM
I tagged this and most definitely plan to install it tomorrow.
I haven't had time to read all the posts here, but just my thoughts on what would be a great addition to this. If this could somehow be connected to separate user accounts, so that a member can have any new threads/posts they make attached to their personal Twitter account, I think it would go a very long way to attract attention to your forums.
Great work!
is_it_me
02-09-2010, 08:52 AM
This looks like what I was looking for; once I get vB 4.02 installed I am going to get my techie helper to install this ? being a numpty myself! :D
thisgeek
02-09-2010, 09:39 AM
Is there a way to include the Poster's name in the tweet? I'm not sure what the syntax would be for the tweet line.
Basically, I just want it to say "Thread name" by "Poster" ... bit.ly/url I can see WHERE to put it, but I'm not sure of the variable that refers to the poster of a thread.
I'd also like to do this - just not sure what variable to use (if it's available).
Just bumping this. Got my users after me to add the poster to the tweets, but I have no idea what variables are available to the plugin.
Is this possible with the plugin as it is right now?
TyPenn613
02-09-2010, 05:17 PM
I looked briefly and didn't see anything related to this. I'm getting the following error:
Parse error: syntax error, unexpected $end in /home/sboards/public_html/forums/newthread.php(262) : eval()'d code on line 27
Bob_R
02-09-2010, 05:20 PM
Looks like I'll be installing this. Too bad there's not a vBulletin to Facebook as well.
redhawk89
02-09-2010, 05:38 PM
not working with vbseo
Bob_R
02-09-2010, 06:16 PM
not working with vbseo
I guess I won't be installing it afterall. :(
not working with vbseo
Yes it is.
http://www.twitter.com/nzboards
Boosted Panda
02-09-2010, 08:07 PM
Im getting a Parse error, syntax error, unexpected T_Variable in ****newthread.php(262) eval()"d code on line 6
boromir86
02-10-2010, 07:02 AM
Im getting a Parse error, syntax error, unexpected T_Variable in ****newthread.php(262) eval()"d code on line 6
I have the same problem. I guess it's because our forums are not in root folder...
wolfyman
02-10-2010, 05:43 PM
vBulletin Message
No Thread specified. If you followed a valid link, please notify the administrator
My url is being tweeted as
mysite.com/forums/showthread.php?t=
I am using custom url in vb 4.0.1, so my thread SHOULD look like:
mysite.com/forums/showthread.php?9833-test-tweet-thread-3
bit.ly seems to be working.. what do I do?
Bob_R
02-10-2010, 06:55 PM
Curiousity question:
Any reason to have this hack and Tweetboard?
Lore Master
02-10-2010, 10:03 PM
Very good mod. Works quickly. I made one thread for testing, and two seconds later 14 guests were reading it. SEO indeed!
wolfyman
02-11-2010, 01:35 AM
checked out tweetboard tonight - very cool, if you're into that type of thing.
Boosted Panda
02-11-2010, 01:40 AM
I have the same problem. I guess it's because our forums are not in root folder...
Id like to see if there is a fix though
Florida13
02-11-2010, 01:53 AM
i think someone installed this on mine, but it doesnt tweet for like 5 minutes or so right?
wolfyman
02-11-2010, 10:18 AM
i think someone installed this on mine, but it doesnt tweet for like 5 minutes or so right?
mine tweets the instant the thread is posted, it's just not linking the correct thread.
thisgeek
02-11-2010, 12:03 PM
Just bumping this. Got my users after me to add the poster to the tweets, but I have no idea what variables are available to the plugin.
Is this possible with the plugin as it is right now?
Nevermind, figured out what variable to use:
Change the line:
$tweet .= $newpost['title'].' '.$shortUrl;
to
$tweet .= $newpost['title'].' by '.$vbulletin->userinfo['username'].' '.$shortUrl;
Simple enough.
Videx
02-11-2010, 12:34 PM
Simple enough.Sure, for those that have bitly working (not me).
wolfyman
02-11-2010, 05:59 PM
anyone understand this better than I do? Why are my tweets coming up with no thread id?
Tweets link to:
mysite.com/forums/showthread.php?t=(NOTHING-HERE!!!!)
SHOULD link to:
mysite.com/forums/showthread.php?9833-test-tweet-thread-3
mabersoft
02-11-2010, 06:05 PM
Any one seen any Boosts in there forum with this? like traffic etc.
sqzdog
02-11-2010, 07:02 PM
I would like to know if this thing will tweet new posts INSTEAD of new threads......
Bob_R
02-11-2010, 08:02 PM
I'm sorry I don't understand. I wish to have this but where do I put the aforementioned PHP code?
In bitly.php or twitter.php or elsewhere?
Bob_R
02-11-2010, 08:52 PM
I actually figured out my post above.
New question: I don't get this
The shortUrl line might look like this:
$shortUrl = 'http://www.vbulletin.com/forum/showthread.php?t='.$newpost[threadid];
How do I know what to put?
Bob_R
02-12-2010, 02:02 AM
My forums are not in my forum root folder. How do I proceed?
This is my error:
Warning: require_once(bitly.php) [function.require-once]: failed to open stream: No such file or directory in [path]/newthread.php(262) : eval()'d code on line 12
Fatal error: require_once() [function.require]: Failed opening required 'bitly.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/xxxxxxx/public_html/dumontnjforum.com/forums/newthread.php(262) : eval()'d code on line 12
And here's my PHP:
// The array below are the ids of non-public forums, update these to be your admin forum ids or anything non-public by default
$excludedForums = array(20);
// If you are having trouble getting bitly URL shortening to work... disable it!
$useBitly = true;
if (!in_array($foruminfo[forumid], $excludedForums)) {
$shortUrl = 'http://www.dumontnjforum.com/forums/showthread.php?t='.$newpost[threadid];
if ($useBitly) {
// http://classes.verkoyen.eu/bitly
require_once 'bitly.php';
$bitly = new Bitly('bitly username', 'bitly API KEY');
$shortUrl = $bitly->shorten('http://www.dumontnjforum.com/forums/showthread.php?t='.$newpost[threadid]);
}
$tweet = '';
if (isset($newpost['prefixid']) && $newpost['prefixid'] != '') {
$tweet = $vbphrase['prefix_'.$newpost['prefixid'].'_title_plain'].' ';
}
$tweet .= $newpost['title'].' '.$shortUrl;
// http://classes.verkoyen.eu/twitter/
require_once 'twitter.php';
$twitter = new Twitter('twitter username', 'twitter password');
$twitter->updateStatus($tweet);
}
Can someone please give me a hand?
Bob_R
02-12-2010, 02:29 AM
Actually I'm getting closer. This is what I got now. How do I fix this?
PHP code is in post above this one.
You must be authenticated to access shorten on line 193 in /home/xxxxxxx/public_html/dumontnjforum.com/forums/bitly.php
#0 /home/xxxxxxx/public_html/dumontnjforum.com/forums/bitly.php(382): Bitly->doCall('shorten', Array)
#1 /home/xxxxxxx/public_html/dumontnjforum.com/forums/newthread.php(262) : eval()'d code(14): Bitly->shorten('http://www.dumo...')
#2 /home/xxxxxxx/public_html/dumontnjforum.com/forums/newthread.php(262): eval()
#3 /home/xxxxxxx/public_html/dumontnjforum.com/forums/vbseo.php(1804): require('/home/bobbyrag/...')
#4 {main}
Warning: Invalid error type specified in [path]/vb/vb.php on line 284
Videx
02-12-2010, 02:40 AM
Hey, if you get bit.ly working, let me know how!
{offtopic}
But an off topic comment from another community forum admin: You've got way too much junk on that forum. A custom theme, vbseo, even a gd arcade! All three of these by themselves can wreak havoc on vb. Not that long time admins haven't gotten them all working together (well, not in vb4 yet), but how many in your community do you really expect to hang out to play in the arcade? Are you making a forum for kids? Asking for trouble, especially if you're on a shared server.
{/offtopic}
Bob_R
02-12-2010, 10:39 AM
Thanks for answering w/o an answer. :confused: Duly noted but not taken seriously because as per another community forum admin you're a shit-stirrer.
Now. Is there an answer in our future? :)
TrailRecon
02-12-2010, 11:01 AM
Thanks for this mod. Easy install and workin perfectly!
My site
http://www.trail-recon.com/vforum/forum.php
The auto twitter updates
https://twitter.com/TrailRecon
thanks again!
Thanks for answering w/o an answer. :confused: Duly noted but not taken seriously because as per another community forum admin you're a shit-stirrer.
Now. Is there an answer in our future? :)
Hey Bob,
Are you 100% certain that your bit.ly credentials are correct?
I thought mine were, but bit.ly for some reason carries a space with the key when you copy/paste it into the box.
(If you want, fire me a PM with your full plugin code, I won't share it with anyone, and might be able to figure it out.)
Bob_R
02-12-2010, 01:58 PM
Hey Bob,
Are you 100% certain that your bit.ly credentials are correct?
I thought mine were, but bit.ly for some reason carries a space with the key when you copy/paste it into the box.
(If you want, fire me a PM with your full plugin code, I won't share it with anyone, and might be able to figure it out.)
Thanks so much bro. You actually gave me an idea/something to look out for and now it works perfectly. :up:
Again, thanks for taking the time to answer. :)
wolfyman
02-12-2010, 02:14 PM
is the space supposed to be there or not?
wolfyman
02-12-2010, 02:14 PM
Thanks so much bro. You actually gave me an idea/something to look out for and now it works perfectly. :up:
Again, thanks for taking the time to answer. :)
what was it?
Bob_R
02-12-2010, 03:35 PM
what was it?
Check your API key very closely.
is the space supposed to be there or not?
No.
TyPenn613
02-12-2010, 05:23 PM
Anyone have any clue why I would get this error?
Parse error: syntax error, unexpected $end in /home/sboards/public_html/forums/newthread.php(262) : eval()'d code on line 27
wolfyman
02-12-2010, 06:05 PM
Check your API key very closely.
No.
meh. No help here, but thanks. I've tried it with the API key and without, I'm just not getting the thread id in my urls.
Boosted Panda
02-12-2010, 07:16 PM
Anyone have any clue why I would get this error?
Parse error: syntax error, unexpected $end in /home/sboards/public_html/forums/newthread.php(262) : eval()'d code on line 27
im getting the same error just a different line of code.
kefallon
02-13-2010, 04:57 AM
Anyone got a fix for an error message like this yet???
Double checked my twitter deatils at bitly and in PHP code all correct still getting following error message.
statuses/update.xml Could not authenticate you. Unauthorized on line 229 in /var/www/vhosts/ionian-island.co.uk/httpdocs/forums/twitter.php
#0 /var/www/vhosts/ionian-island.co.uk/httpdocs/forums/twitter.php(648): Twitter->doCall('statuses/update...', Array, true)
#1 /var/www/vhosts/ionian-island.co.uk/httpdocs/forums/newthread.php(262) : eval()'d code(26): Twitter->updateStatus('test http://www...')
#2 /var/www/vhosts/ionian-island.co.uk/httpdocs/forums/newthread.php(262): eval()
#3 {main}
Videx
02-13-2010, 08:46 AM
Maybe what we need to track down these auth errors is some breakpoints in the code. Switch 'debug' mode on, and instead of submitting the code to Twitter and bitly, the app just emails us the results, or prints it out or something.
Majora
02-13-2010, 01:39 PM
Your hack https://vborg.vbsupport.ru/showthread.php?t=234288&highlight=twitter has problems with vowel letters ?, ?, ?
This will not display correctly for me:
http://twitter.com/feuerwehr_alarm
How can I fix this problem?
I am getting this error
{ "errorCode": 0, "errorMessage": "", "results": { "http://www.forums.emonx.com/showthread.php?t=16361": { "hash": "alhONj", "shortCNAMEUrl": "http://bit.ly/atZtHs", "shortKeywordUrl": "", "shortUrl": "http://bit.ly/atZtHs", "userHash": "atZtHs" } }, "statusCode": "OK" }Invalid JSON-response on line 196 in /home/admin/emonx.com/forum/bitly.php
#0 /home/admin/emonx.com/forum/bitly.php(382): Bitly->doCall('shorten', Array)
#1 /home/admin/emonx.com/forum/newthread.php(262) : eval()'d code(10): Bitly->shorten('http://www.foru...')
#2 /home/admin/emonx.com/forum/newthread.php(262): eval()
#3 {main}
Fatal error: Invalid JSON-response on line 196 in [path]/bitly.php in [path]/vb/vb.php on line 284
#0 vb_error_handler(256, Invalid JSON-response on line 196 in /home/admin/emonx.com/forum/bitly.php , /home/admin/emonx.com/forum/vb/vb.php, 284, Array ([exception] => BitlyException Object ([] => Invalid JSON-response,[] => ,[] => 0,[] => /home/admin/emonx.com/forum/bitly.php,[] => 196,[] => Array ([0] => Array ([file] => /home/admin/emonx.com/forum/bitly.php,[line] => 382,[function] => doCall,[class] => Bitly,[type] => ->,[args] => Array ([0] => shorten,[1] => Array ([longUrl] => http://www.forums.emonx.com/showthread.php?t=16361,[history] => 1))),[1] => Array ([file] => /home/admin/emonx.com/forum/newthread.php(262) : eval()'d code,[line] => 10,[function] => shorten,[class] => Bitly,[type] => ->,[args] => Array ([0] => http://www.forums.emonx.com/showthread.php?t=16361)),[2] => Array ([file] => /home/admin/emonx.com/forum/newthread.php,[line] => 262,[function] => eval))),[code] => 256)) called at [(null):0] #1 trigger_error(Invalid JSON-response on line 196 in /home/admin/emonx.com/forum/bitly.php , 256) called at [/home/admin/emonx.com/forum/vb/vb.php:284] #2 vB::handleException(BitlyException Object ([] => Invalid JSON-response,[] => ,[] => 0,[] => /home/admin/emonx.com/forum/bitly.php,[] => 196,[] => Array ([0] => Array ([file] => /home/admin/emonx.com/forum/bitly.php,[line] => 382,[function] => doCall,[class] => Bitly,[type] => ->,[args] => Array ([0] => shorten,[1] => Array ([longUrl] => http://www.forums.emonx.com/showthread.php?t=16361,[history] => 1))),[1] => Array ([file] => /home/admin/emonx.com/forum/newthread.php(262) : eval()'d code,[line] => 10,[function] => shorten,[class] => Bitly,[type] => ->,[args] => Array ([0] => http://www.forums.emonx.com/showthread.php?t=16361)),[2] => Array ([file] => /home/admin/emonx.com/forum/newthread.php,[line] => 262,[function] => eval)))) called at [(null):0]
DoubleGlasses
02-13-2010, 06:44 PM
I installed this today on Vbulletin 4.0.1 and it worked flawlessly. This is the first time that I've added a plugin that I didn't just upload a file for. I have one tiny suggestion - and I recognize that this might be a significant suggestion - but it would be great if it could take the post tags and make them hash tags with the post to twitter.
argothiusz
02-14-2010, 12:34 AM
Installed and work perfectly fine. Although, I would love to to use $includeforums function instead of $excludeforums. Such a pain to go over 200+ forums to exclude them lol
Videx
02-14-2010, 12:46 AM
I am getting this error... Invalid JSON-responseThis has been covered; it's a server issue. You need to read this entire thread.
Anyone have any clue why I would get this error?
Parse error: syntax error, unexpected $end in /home/sboards/public_html/forums/newthread.php(262) : eval()'d code on line 27
I get the same error!
wolfyman
02-14-2010, 02:37 PM
I can't believe I'm the only one who gets the empty thread id. Why is god picking on me?!
GameExploiters
02-14-2010, 02:52 PM
I have a big forum and i installed this but sometimes when making a new post happens sometimes not always but twitter has limits for 150 tweets now I have exceeded this i guess so I have to disable it every now and then. Is there a way to edit this to allow people to create threads but if the thread doesn't work to skip this and still allow them to post the thread.
Fatal error: User is over daily status update limit. on line 204 in [path]/twitter.php
I'd love to have a fix for this as this twitter idea is very good for advertising. Thanks
I can't believe I'm the only one who gets the empty thread id. Why is god picking on me?!
This might be a silly question, but.. do you maybe have your URLs set to something other than Standard URLs?
It makes bitLY links but doesn't post up on twitter now :(
icarusforde
02-15-2010, 08:04 AM
Not having much luck with this atm.... Anyone able to give me hand/spot whats off with my code?
// The array below are the ids of non-public forums, update these to be your admin forum ids or anything non-public by default
$excludedForums = array(9,10,55,40,62,36,61,19,50,12,27,28,71,72,73, 74,29,30,31,32,33,34,39,49,54,65,70,78,75,76,47,45 ,81,82,6,7,80);
// If you are having trouble getting bitly URL shortening to work... disable it!
$useBitly = true;
if (!in_array($foruminfo[forumid], $excludedForums)) {
$shortUrl = 'http://www.collegetalkspot.com/showthread.php?t='.$newpost[threadid];
if ($useBitly) {
// http://classes.verkoyen.eu/bitly
require_once 'bitly.php';
$bitly = new Bitly('<collegetalkspot>', '<R_********************************>');
$shortUrl = $bitly->shorten($shortUrl);
}
$tweet = '';
if (isset($newpost['prefixid']) && $newpost['prefixid'] != '') {
$tweet = $vbphrase['prefix_'.$newpost['prefixid'].'_title_plain'].' ';
}
$tweet .= $newpost['title'].' '.$shortUrl;
// http://classes.verkoyen.eu/twitter/
require_once 'twitter.php';
$twitter = new Twitter('<collegetalkspot>','<**************>');
$twitter->updateStatus($tweet);
}
This is the error i keep getting:
Fatal error: Uncaught exception 'BitlyException' with message 'You must be authenticated to access shorten' in /home/srorg/public_html/collegetalkspot.com/bitly.php:193 Stack trace: #0 /home/srorg/public_html/collegetalkspot.com/bitly.php(382): Bitly->doCall('shorten', Array) #1 /home/srorg/public_html/collegetalkspot.com/global.php(28) : eval()'d code(30): Bitly->shorten('http://www.coll...') #2 /home/srorg/public_html/collegetalkspot.com/global.php(28): eval() #3 /home/srorg/public_html/collegetalkspot.com/forum.php(69): require_once('/home/srorg/pub...') #4 {main} thrown in /home/srorg/public_html/collegetalkspot.com/bitly.php on line 193
I've got all the files in the right places, in the root directory. I'm currently running with all plugins disabled, because if i even attempt to delete the plugin and the files then it just throws that error and won't go away...
Videx
02-15-2010, 10:29 AM
First, you could just disable bitly (change $useBitly= ; to false). In the above code I see the <> signs included in both your keys; they aren't supposed to be.
lhridley
02-15-2010, 11:16 AM
ok, I've installed this per the instructions and it's working great for new threads; however, I tried to also install a duplicate using the hook "newreply_post_complete" to get thread replies tweeted as well, and that doesn't seem to be working.
I have a technical forum with a moderate amount of activity, and tweets when threads receive replies are important to my members. Any guidance on modifying this to tweet thread replies would be great!
wolfyman
02-15-2010, 11:28 AM
This might be a silly question, but.. do you maybe have your URLs set to something other than Standard URLs?
Holy crap someone answered me!!! WOOOT!!!!
;)
Actually, yes I do.
URLs are set to: Basic Friendly URLs
Here is my Twitter plugin code:
// The array below are the ids of non-public forums, update these to be your admin forum ids or anything non-public by default
$excludedForums = array(33,32,6,14);
// If you are having trouble getting bitly URL shortening to work... disable it!
$useBitly = true;
if (!in_array($foruminfo[forumid], $excludedForums)) {
$shortUrl = 'http://**********.com/forums/showthread.php?'.$newpost[threadid];
if ($useBitly) {
// http://classes.verkoyen.eu/bitly
require_once 'bitly.php';
$bitly = new Bitly('*********', '*************************');
$shortUrl = $bitly->shorten($shortUrl);
}
$tweet = '';
if (isset($newpost['prefixid']) && $newpost['prefixid'] != '') {
$tweet = $vbphrase['prefix_'.$newpost['prefixid'].'_title_plain'].' ';
}
$tweet .= $newpost['title'].' '.$shortUrl;
// http://classes.verkoyen.eu/twitter/
require_once 'twitter.php';
$twitter = new Twitter('***********','*********');
$twitter->updateStatus($tweet);
}
lhridley
02-15-2010, 12:16 PM
OK, I was able to answer my own question.
The issue had to do with the context of the tweet; if the tweet appeared to be one that had already been sent through the API, then it did not post, which is why replies to posts weren't showing up when I hooked into newpost_complete.
The solution: add a date/timestamp to the tweet.
I modified the tweet contents to contain:
$tweet .= date("F j, Y, g:i:s a");
as part of the $tweet string, which generates a date/time stamp in the format of Month day, Year hour:min:sec am/pm. This differentiates the tweet context enough so that a new tweet is posted.
Then, attach the plugin to newpost_complete and newthread_post_complete and you get posts for new threads, and replies to new threads.
Cool!
Holy crap someone answered me!!! WOOOT!!!!
;)
Actually, yes I do.
URLs are set to: Basic Friendly URLs
Here is my Twitter plugin code:
// The array below are the ids of non-public forums, update these to be your admin forum ids or anything non-public by default
$excludedForums = array(33,32,6,14);
// If you are having trouble getting bitly URL shortening to work... disable it!
$useBitly = true;
if (!in_array($foruminfo[forumid], $excludedForums)) {
$shortUrl = 'http://**********.com/forums/showthread.php?'.$newpost[threadid];
if ($useBitly) {
// http://classes.verkoyen.eu/bitly
require_once 'bitly.php';
$bitly = new Bitly('*********', '*************************');
$shortUrl = $bitly->shorten($shortUrl);
}
$tweet = '';
if (isset($newpost['prefixid']) && $newpost['prefixid'] != '') {
$tweet = $vbphrase['prefix_'.$newpost['prefixid'].'_title_plain'].' ';
}
$tweet .= $newpost['title'].' '.$shortUrl;
// http://classes.verkoyen.eu/twitter/
require_once 'twitter.php';
$twitter = new Twitter('***********','*********');
$twitter->updateStatus($tweet);
}
I'd be quite surprised if this worked with anything other than Standard URLs.
Standard: showthread.php?t=threadid
Friendly: showthread.php?threadttitle
Plugin:
$shortUrl = 'http://www.yourforumsdomain.com/showthread.php?t='.$newpost[threadid];
My guess would be that the URL format has to be set to Standard for this mod to work. You could try changing $newpost[threadid] to $newpost[title], not sure if that will work though. :)
eMike
02-15-2010, 01:50 PM
buro9
Fantastic mod, awesome support.
Managed to get it to work just fine by reading through all the posts.
5 stars!
:)
Hateman
02-15-2010, 02:06 PM
Hi girls,
i got this error by submitting a thread:
syntax error, unexpected $end .... like the other peoples here. Do you support this mod?
Hi girls,
i got this error by submitting a thread:
syntax error, unexpected $end .... like the other peoples here. Do you support this mod?
Hello Penelope,
What is the content of your plugin?
If you filled it in correctly, that error does not occur.
steeler7
02-15-2010, 03:10 PM
2 Things are/aen't happening for me...
1. New threads aren't showing up in Twitter.
2. After I finish typing out a new thread and click "Submit new thread" it submits it but I get a blank screen and need to click the back arrow on my browser and then click on the forum and it shows the Thread that I had made.
Here's my code...
// The array below are the ids of non-public forums, update these to be your admin forum ids or anything non-public by default
$excludedForums = array(1,2,3,35,36,37,38,39,40,43);
// If you are having trouble getting bitly URL shortening to work... disable it!
$useBitly = true;
if (!in_array($foruminfo[forumid], $excludedForums)) {
$shortUrl = 'http://www.pittsburghsportstavern.com/forum/showthread.php?t='.$newpost[threadid];
if ($useBitly) {
// http://classes.verkoyen.eu/bitly
require_once 'bitly.php';
$bitly = new Bitly('kipper51', 'R_**************');
$shortUrl = $bitly->shorten($shortUrl);
}
$tweet = '';
if (isset($newpost['prefixid']) && $newpost['prefixid'] != '') {
$tweet = $vbphrase['prefix_'.$newpost['prefixid'].'_title_plain'].' ';
}
$tweet .= $newpost['title'].' '.$shortUrl;
// http://classes.verkoyen.eu/twitter/
require_once 'twitter.php';
$twitter = new Twitter('pghsportstavern','********');
$twitter->updateStatus($tweet);
}
I put the 2 attached files in my "/forum" folder.
I triple checked my bitly and twitter information and it appears to be correct
Does it make it to Twitter?
Have you checked your error_log to see if that sheds light on the white page issue? I'd guess out of memory, but that is a total stab in the dark.
steeler7
02-15-2010, 03:41 PM
Does it make it to Twitter?
Have you checked your error_log to see if that sheds light on the white page issue? I'd guess out of memory, but that is a total stab in the dark.
It doesn't make it to Twitter.
Sorry it took me a few minutes i went into my server to download the error log and look through. Couldn't find anything
Hateman
02-15-2010, 04:05 PM
Hello Penelope,
What is the content of your plugin?
If you filled it in correctly, that error does not occur.
Hi there,
here is my code=
// The array below are the ids of non-public forums, update these to be your admin forum ids or anything non-public by default
$excludedForums = array(59,64);
// If you are having trouble getting bitly URL shortening to work... disable it!
$useBitly = true;
if (!in_array($foruminfo[forumid], $excludedForums)) {
$shortUrl = 'http://forum.domain.de/showthread.php?t='.$newpost[threadid];
if ($useBitly) {
// http://classes.verkoyen.eu/bitly
require_once 'bitly.php';
$bitly = new Bitly('BITLYNAME', 'R_APIKEY');
$shortUrl = $bitly->shorten($shortUrl);
}
$tweet = '';
if (isset($newpost['prefixid']) && $newpost['prefixid'] != '') {
$tweet = $vbphrase['prefix_'.$newpost['prefixid'].'_title_plain'].' ';
}
$tweet .= $newpost['title'].' '.$shortUrl;
// http://classes.verkoyen.eu/twitter/
require_once 'twitter.php';
$twitter = new Twitter('MYTWITTERNAME','MYPASSWORD'
steeler7
02-15-2010, 04:48 PM
I noticed while logged into my bitly account that the 2 test threads I had tried are being shown on the "Home" section. They just never went from bitly to Twitter. I have the correct Twitter information submitted to bitly. Is there something else I'm supposed to do?
Hi there,
here is my code=
// The array below are the ids of non-public forums, update these to be your admin forum ids or anything non-public by default
$excludedForums = array(59,64);
// If you are having trouble getting bitly URL shortening to work... disable it!
$useBitly = true;
if (!in_array($foruminfo[forumid], $excludedForums)) {
$shortUrl = 'http://forum.domain.de/showthread.php?t='.$newpost[threadid];
if ($useBitly) {
// http://classes.verkoyen.eu/bitly
require_once 'bitly.php';
$bitly = new Bitly('BITLYNAME', 'R_APIKEY');
$shortUrl = $bitly->shorten($shortUrl);
}
$tweet = '';
if (isset($newpost['prefixid']) && $newpost['prefixid'] != '') {
$tweet = $vbphrase['prefix_'.$newpost['prefixid'].'_title_plain'].' ';
}
$tweet .= $newpost['title'].' '.$shortUrl;
// http://classes.verkoyen.eu/twitter/
require_once 'twitter.php';
$twitter = new Twitter('MYTWITTERNAME','MYPASSWORD'
You're missing a chunk of code.
);
$twitter->updateStatus($tweet);
}
wolfyman
02-15-2010, 08:39 PM
it just started working.
I have no idea why, but it did. :rolleyes:
steeler7
02-16-2010, 12:19 AM
Ok... I basically disabled bit.ly by changing the variable from true to false, did a test thread post and it went straight to Twitter, no white screen or anything. worked nice except for the super long Link.
So, I've narrowed the problem down to being a bit.ly issue and I remember reading in this thread where others had the same issue. did anyone figure out a way to solve this?
lhridley
02-16-2010, 12:20 AM
Well, shoot. Now the bitly link to replies takes users to the "page not found" page on vBulletin. So, I don't have the replies piece working after all (however, the new threads component works great).
Anyone else get replies tweets working?
icarusforde
02-16-2010, 01:42 AM
First, you could just disable bitly (change $useBitly= ; to false). In the above code I see the <> signs included in both your keys; they aren't supposed to be.
Ah, always the obvious ones that nail me. >.<
Call myself a coder and i don't find the right thing to fix my own screwups. xD
I'll try it *without* them now. :D
Edit: Thanks, this worked for me. :P
I also figured out why it wouldn't go away even when i disabled the plugin... I'd edited another plugin by another name by mistake and it had the screwed up code in it. :P
jandb
02-16-2010, 03:35 AM
If you are having problems with not being authorised make sure you don't have a extra space after your API key before the last ' . This worked for me and everything is running fine now.
steeler7
02-16-2010, 04:54 AM
I've tried everything within my ability. Re-copied code and started from scratch, I reset the API key and put it in (no blank space at the end).
If I have bit.ly turned on, I get a blank screen, no errors that I can find. The post/thread goes through. I have to hit the back button and view the forum to see the thread. It doesn't go to Twitter, it shows up at Bit.ly. It gets listed, has a shortened URL that can posted to Twitter. If I choose that, it goes there just fine.... If I turn off Bit.ly, the new Thread goes through to Twitter with no problems and no white screen. I just have a really long URL
lhridley
02-16-2010, 09:55 AM
ok, for those who want to post thread replies and new threads to twitter -- I think I figured this out.
1. Use the following to create a string for new threads (modify to suite you, but leave the datestamp portion in) -- keep the rest of the provided plugin code as is:
$tweet = '';
if (isset($newpost['prefixid']) && $newpost['prefixid'] != '') {
$tweet .= date("YMj g:i:s a") . ' ' . $vbphrase['prefix_'.$newpost['prefixid'].'_title_plain'].' ';
}
$tweet .= date("Ydj g:i:s a") . ' ' .$newpost['title'].' '.$shortUrl;
$tweet .= ' new thread #mysearchterm'; //replace #mysearchterm with something related to your forum
2. Hook at newthread_post_complete
3. Use the following plugin code for replies:
// The array below are the ids of non-public forums, update these to be your admin forum ids or anything non-public by default
$excludedForums = array();
// If you are having trouble getting bitly URL shortening to work... disable it!
$useBitly = true;
if (!in_array($threadinfo[forumid], $excludedForums)) {
$shortUrl = 'http://www.myforumdomainname.co/showthread.php?t='.$threadinfo[threadid];
if ($useBitly) {
// http://classes.verkoyen.eu/bitly
require_once 'bitly.php';
$bitly = new Bitly('mybitlyaccountid', 'mybitlykey');
$shortUrl = $bitly->shorten($shortUrl);
}
$tweet = '';
$tweet .= date("YMj g:i:s a") . ' ' . $vbphrase['prefix_'.$threadinfo['prefixid'].'_title_plain'].' ';
$tweet .= $threadinfo['title'].' '.$shortUrl;
$tweet .= ' new reply #keyword'; //again, use a #keyword related to your forum
// http://classes.verkoyen.eu/twitter/
require_once 'twitter.php';
$twitter = new Twitter('mytwitteraccount','mypassword');
$twitter->updateStatus($tweet);
}
4. Use the following "two" hooks for the above code snippet:
newreply_post_ajax
newreply_post_complete
It looks like vBulletin triggers one or the other upon posting a new reply, but not both (and, most new posts will go through 'newreply_post_ajax'). vBulletin plugins are a new thing for me -- took a bit to figure this one out.
You can see a working feed at http://www.twitter.com/mediawikiusers
tokenyank
02-16-2010, 05:06 PM
installed and working!
http://www.twitter.com/mumsonline
Thanks!
lazydesis
02-16-2010, 06:50 PM
works perfectly in vb3.8 ...thanks for this
mtlcore
02-17-2010, 04:56 AM
Great mod! Really worth it if someone teamed up with you to develop it into a full product.
I am getting this error though:
Warning: curl_setopt_array() [function.curl-setopt-array]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in [path]/twitter.php on line 189
/statuses/update.xml Could not authenticate you.
Fatal error: Uncaught exception 'TwitterException' with message 'Unauthorized' in /home/mysite/public_html/forums/twitter.php:229 Stack trace: #0 /home/mysite/public_html/forums/twitter.php(648): Twitter->doCall('statuses/update...', Array, true) #1 /home/mysite/public_html/forums/newthread.php(273) : eval()'d code(26): Twitter->updateStatus('testing http://...') #2 /home/mysite/public_html/forums/newthread.php(273): eval() #3 /home/mysite/public_html/forums/vbseo.php(1129): require('/home/mysite/p...') #4 {main} thrown in /home/mysite/public_html/forums/twitter.php on line 229
I have curl enabled, safe_mode is off, open_basedir has a local value:
home/mysite:/usr/lib/php:/usr/local/lib/php:/tmp and no value under master value.
I've checked all the code in the plugin, all exactly the same as yours (with my info ofcourse).
bit.ly seems to be working fine since new URLs are being created, just not being posted to Twitter...
EDIT
I got it to work! BUT no bit.ly URL :(
Here what I did, I went into twitter.php and set the following to false.
$options[CURLOPT_FOLLOWLOCATION] = false;
now to solve the bit.ly issue.
Thanks
hiker
02-17-2010, 02:18 PM
Could I use this with multiple twitter accounts?
For example, I've got a hiking forum that I'd like to go to a hiking related twitter account, then I've got a mountain biking forum (same board) that I'd like to go to a different mountain biking related twitter account.
Is this possible?
Thanks, great mod regardless.
whelck
02-17-2010, 08:55 PM
After reading the entire thread, I have wonderfully concluded my error message is different from any other!
Expectation Failed on line 229 in /var/www/ufck/forums/twitter.php
#0 /var/www/ufck/forums/twitter.php(648): Twitter->doCall('statuses/update...', Array, true)
#1 /var/www/ufck/forums/newthread.php(262) : eval()'d code(26): Twitter->updateStatus('test http://bit...')
#2 /var/www/ufck/forums/newthread.php(262): eval()
#3 {main}
What is broken?
Pro-eSports.com
02-17-2010, 09:32 PM
Can you select the forums you want to be tweeted? if not then this would be a great addition for future updates.
whelck
02-17-2010, 09:39 PM
Can you select the forums you want to be tweeted? if not then this would be a great addition for future updates.
You can select which forums you *don't* want tweeted, so you end up accomplishing the same thing.
Pro-eSports.com
02-17-2010, 09:49 PM
Awesome, I'm gonna install this great mod then. :D
lhridley
02-18-2010, 02:16 AM
Could I use this with multiple twitter accounts?
For example, I've got a hiking forum that I'd like to go to a hiking related twitter account, then I've got a mountain biking forum (same board) that I'd like to go to a different mountain biking related twitter account.
Is this possible?
Thanks, great mod regardless.
Yes, with some modifications. Contact me at webmaster@mwusers.com for more info.
steeler7
02-18-2010, 02:34 AM
Anyone who had issues with Bit.ly ... figure out how to resolve that issue? I want to sue this Mod so bad but my url's are really long without being shortened
lhridley
02-18-2010, 02:42 AM
I want to sue this Mod so bad but my url's are really long without being shortened
Um....do you mean "use" and not "sue"?
lhridley
02-18-2010, 02:45 AM
I've been really surprised at the number of people posting about issues with Bit.ly. It took me all of five minutes to set up my account with them and get that working. I've had many more issues with the mod itself.
For example, it doesn't check to see if the title of a thread exceeds the 140 character length allowed for a tweet -- this causes an Exception error to be thrown that's not captured and handled anywhere -- which is fine for a programmer ,but doesn't really help an end user when they see a screen dump of gobbledygook in response to submitting a thread with a long title.
:/
puppetmaster222
02-18-2010, 02:51 AM
Simple and effective. I had no problems getting it to work right out of the gate, thanks.
steeler7
02-18-2010, 03:33 AM
Um....do you mean "use" and not "sue"?
Ah yes... I meant "use" . sorry about that
Netaudio
02-18-2010, 09:32 AM
Hi,
after posting:
invalid body on line 660 in /var/www/web5/html/vb3/twitter.php
#0 /var/www/web5/html/vb3/newthread.php(262) : eval()'d code(26): Twitter->updateStatus('24.04.2010 - 4 ...')
#1 /var/www/web5/html/vb3/newthread.php(262): eval()
#2 /var/www/web5/html/vb3/vbseo.php(1629): require('/var/www/web5/h...')
#3 {main}
How can i fix it?
V8Owner
02-18-2010, 12:33 PM
Downloaded, installed & tweeting away.
Thanks :) :D
This has been covered; it's a server issue. You need to read this entire thread.
oh my holy god, any symptoms of page number can help me from several blood pressure problems
Pro-eSports.com
02-18-2010, 03:23 PM
Do I have to enter the sub-forum ID's too or are the main forum ID's enough?
Do category ID's work too?
Hateman
02-18-2010, 03:39 PM
Hello,
i got this error:
Warnung: curl_setopt_array() [function.curl-setopt-array]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in [path]/bitly.php (Zeile 141)
{ "errorCode": 0, "errorMessage": "", "results": { "http://forum.mydomain.de/showthread.php?t=3680": { "hash": "dAunjV", "shortCNAMEUrl": "http://bit.ly/9857Z4", "shortKeywordUrl": "", "shortUrl": "http://bit.ly/9857Z4", "userHash": "9857Z4" } }, "statusCode": "OK" }Invalid JSON-response on line 196 in /var/www/virtual/mydomain.de/forum/htdocs/bitly.php
#0 /var/www/virtual/mydomain.de/forum/htdocs/bitly.php(382): Bitly->doCall('shorten', Array)
#1 /var/www/virtual/mydomain.de/forum/htdocs/newthread.php(262) : eval()'d code(14): Bitly->shorten('http://forum.em...')
#2 /var/www/virtual/mydomain.de/forum/htdocs/newthread.php(262): eval()
#3 /var/www/virtual/mydomain.de/forum/htdocs/vbseo.php(1629): require('/var/www/virtua...')
#4 {main}
Schwerer Fehler: Invalid JSON-response on line 196 in [path]/bitly.php in [path]/vb/vb.php (Zeile 284)
#0 vb_error_handler(256, Invalid JSON-response on line 196 in /var/www/virtual/mydomain.de/forum/htdocs/bitly.php , /var/www/virtual/mydomain.de/forum/htdocs/vb/vb.php, 284, Array ([exception] => BitlyException Object ([] => Invalid JSON-response,[] => ,[] => 0,[] => /var/www/virtual/mydomain.de/forum/htdocs/bitly.php,[] => 196,[] => Array ([0] => Array ([file] => /var/www/virtual/mydomain.de/forum/htdocs/bitly.php,[line] => 382,[function] => doCall,[class] => Bitly,[type] => ->,[args] => Array ([0] => shorten,[1] => Array ([longUrl] => http://forum.mydomain.de/showthread.php?t=3680,[history] => 1))),[1] => Array ([file] => /var/www/virtual/mydomain.de/forum/htdocs/newthread.php(262) : eval()'d code,[line] => 14,[function] => shorten,[class] => Bitly,[type] => ->,[args] => Array ([0] => http://forum.mydomain.de/showthread.php?t=3680)),[2] => Array ([file] => /var/www/virtual/mydomain.de/forum/htdocs/newthread.php,[line] => 262,[function] => eval),[3] => Array ([file] => /var/www/virtual/mydomain.de/forum/htdocs/vbseo.php,[line] => 1629,[args] => Array ([0] => /var/www/virtual/mydomain.de/forum/htdocs/newthread.php),[function] => require))),[code] => 256)) called at [(null):0] #1 trigger_error(Invalid JSON-response on line 196 in /var/www/virtual/mydomain.de/forum/htdocs/bitly.php , 256) called at [/var/www/virtual/mydomain.de/forum/htdocs/vb/vb.php:284] #2 vB::handleException(BitlyException Object ([] => Invalid JSON-response,[] => ,[] => 0,[] => /var/www/virtual/mydomain.de/forum/htdocs/bitly.php,[] => 196,[] => Array ([0] => Array ([file] => /var/www/virtual/mydomain.de/forum/htdocs/bitly.php,[line] => 382,[function] => doCall,[class] => Bitly,[type] => ->,[args] => Array ([0] => shorten,[1] => Array ([longUrl] => http://forum.mydomain.de/showthread.php?t=3680,[history] => 1))),[1] => Array ([file] => /var/www/virtual/mydomain.de/forum/htdocs/newthread.php(262) : eval()'d code,[line] => 14,[function] => shorten,[class] => Bitly,[type] => ->,[args] => Array ([0] => http://forum.mydomain.de/showthread.php?t=3680)),[2] => Array ([file] => /var/www/virtual/mydomain.de/forum/htdocs/newthread.php,[line] => 262,[function] => eval),[3] => Array ([file] => /var/www/virtual/mydomain.de/forum/htdocs/vbseo.php,[line] => 1629,[args] => Array ([0] => /var/www/virtual/mydomain.de/forum/htdocs/newthread.php),[function] => require)))) called at [(null):0]
Best regards
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.