Register Members List Search Today's Posts Mark Forums Read

Reply
 
Mod Options
vBulletin to Twitter, live tweets of new threads Details »»
vBulletin to Twitter, live tweets of new threads
Mod Version: 1.00, by buro9 (Coder) buro9 is offline
Developer Last Online: Jul 2012 I like it Show Printable Version Email this Page

vB Version: 4.0.x Rating: (74 votes - 4.14 average) Installs: 272
Released: 27 Jan 2010 Last Update: Never Downloads: 1408
Not Supported Uses Plugins Additional Files Re-usable Code Translations External Content  

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) 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):

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

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:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Download Now

Only licensed members can download files, Click Here for more information.

Show Your Support

  • To receive notifications regarding updates -> Click to Mark as Installed.
  • If you like this modification support the author by donating.
  • This modification may not be copied, reproduced or published elsewhere without author's permission.
Similar Mod
Mod Developer Type Replies Last Post
vBulletin 2 Twitter - Take Your News Straight To Twitter! AHealthForum vBulletin 3.8 Add-ons 115 22 Feb 2013 22:02

  #31  
Old 27 Jan 2010, 21:07
buro9 buro9 is offline
 
Join Date: Feb 2002
Originally Posted by Nordinho View Post
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:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

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.
Reply With Quote
  #32  
Old 27 Jan 2010, 21:33
Nordinho Nordinho is offline
 
Join Date: Aug 2004
Originally Posted by buro9 View Post
Scary. You are having fun.

In bitly.php where you have these lines:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

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.
Reply With Quote
  #33  
Old 27 Jan 2010, 21:37
buro9 buro9 is offline
 
Join Date: Feb 2002
Basically this:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

You need to see what is coming back before the exception gets thrown.
Reply With Quote
  #34  
Old 27 Jan 2010, 21:40
Nordinho Nordinho is offline
 
Join Date: Aug 2004
Originally Posted by buro9 View Post
Basically this:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

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" }
Reply With Quote
  #35  
Old 27 Jan 2010, 21:43
buro9 buro9 is offline
 
Join Date: Feb 2002
Strange... it's working perfectly fine.

What version of PHP are you using?
Reply With Quote
  #36  
Old 27 Jan 2010, 21:46
Nordinho Nordinho is offline
 
Join Date: Aug 2004
Originally Posted by buro9 View Post
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
Reply With Quote
  #37  
Old 27 Jan 2010, 22:01
buro9 buro9 is offline
 
Join Date: Feb 2002
Originally Posted by Nordinho View Post
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.
Reply With Quote
  #38  
Old 27 Jan 2010, 22:05
Nordinho Nordinho is offline
 
Join Date: Aug 2004
Allrighty, thanks for the help sofar!
Reply With Quote
  #39  
Old 28 Jan 2010, 00:11
Jesh Jesh is offline
 
Join Date: Aug 2009
Getting 500 internal server error, any ideas?

Last edited by Jesh : 28 Jan 2010 at 00:20.
Reply With Quote
  #40  
Old 28 Jan 2010, 03:43
Bouncer222 Bouncer222 is offline
 
Join Date: Oct 2009
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!
Reply With Quote
  #41  
Old 28 Jan 2010, 04:04
blake247 blake247 is offline
 
Join Date: Sep 2008
Originally Posted by LbR View Post
Getting this error


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.
I have the same error
__________________
Masons of Texas
http://www.masonsoftexas.com
Reply With Quote
  #42  
Old 28 Jan 2010, 08:53
MrKing MrKing is offline
 
Join Date: Feb 2009
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*
__________________
MrKing - www.pygmychameleon.co.uk - dvbnetwork.net

Reply With Quote
  #43  
Old 28 Jan 2010, 09:51
zachsg zachsg is offline
 
Join Date: Nov 2009
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.
Reply With Quote
  #44  
Old 28 Jan 2010, 10:12
Moondust Moondust is offline
 
Join Date: Jan 2010
no Spaces in the API Key and username, all ceck more as 10x Times..... only the Errorcode :-(
Reply With Quote
  #45  
Old 28 Jan 2010, 10:27
IndigoSociety IndigoSociety is offline
 
Join Date: Nov 2008
This is great
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Mod Options

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Jump


New To Site? Need Help?

All times are GMT. The time now is 14:19.

Layout Options | Width: Wide Color: