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 (Member) buro9 is offline
Developer Last Online: Jul 2012 I like it Show Printable Version Email this Page

This thread is in the Modification Graveyard.
vB Version: 4.0.x Rating: (33 votes - 4.67 average) Installs: 272
Released: 27 Jan 2010 Last Update: Never Downloads: 1482
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

  • 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
Add-On Releases vBulletin 2 Twitter - Take Your News Straight To Twitter! AHealthForum vBulletin 3.8 Add-ons 116 07 May 2020 02:27

  #436  
Old 19 Jun 2010, 03:15
vilhiem vilhiem is offline
 
Join Date: May 2010
ok ... my bad ... got it working (sorry I jumped the gun there)

But I do have a question ... it works great ... but is there a simple way to get this to work on "replies" ...? I saw someone in this thread posted a possible solution ... just not sure if it's the best.

Thnx!
Reply With Quote
  #437  
Old 19 Jun 2010, 18:36
LuisManson LuisManson is offline
 
Join Date: Jun 2010
there seems to be an upgrade to twitter.class here:
http://classes.verkoyen.eu/twitter_oauth

no idea if the api is the same
Reply With Quote
  #438  
Old 20 Jun 2010, 04:08
vilhiem vilhiem is offline
 
Join Date: May 2010
so ... I incorporated the mod to this mod (contributed by lhridley) ... the one allowing for 'replies' to work too ... and it worked fine! Just be sure to be careful with the code, there's a missing "m" in the ".com" portion of the URL (and I think a few other things). Otherwise, works great!

QUESTION: Is there any way I can transfer the "tags" from new posts to the "#keywords" in the code for this plugin ...?

Thanks!
Reply With Quote
  #439  
Old 21 Jun 2010, 17:14
vilhiem vilhiem is offline
 
Join Date: May 2010
One more question ...

Not sure if anyone else here has noticed this ... but it doesn't seem to work if the new thread is "auto-generated". For instance, I'm using a couple mods that make new threads, yet no "twits" are generated:

(1) "BBR - Welcome Thread Upon Registration"; and
(2) "auto-reply"
Reply With Quote
  #440  
Old 22 Jun 2010, 15:14
jhellein jhellein is offline
 
Join Date: Jun 2010
Do I need to create a separate plugin to auto-tweet blog posts in 4.0.3? Will the same code work or does it need to be modified? Thank you.
Reply With Quote
  #441  
Old 22 Jun 2010, 16:17
Dragonsys's Avatar
Dragonsys Dragonsys is offline
 
Join Date: Jan 2008
Real name: Eric
Originally Posted by vilhiem View Post
One more question ...

Not sure if anyone else here has noticed this ... but it doesn't seem to work if the new thread is "auto-generated". For instance, I'm using a couple mods that make new threads, yet no "twits" are generated:

(1) "BBR - Welcome Thread Upon Registration"; and
(2) "auto-reply"
I believe those mods submit the new auto-post straight to the DB, so they do not use the normal submit post method, and therefore they bypass this tweet mod all together.
Reply With Quote
  #442  
Old 22 Jun 2010, 16:46
vilhiem vilhiem is offline
 
Join Date: May 2010
Originally Posted by Dragonsys View Post
I believe those mods submit the new auto-post straight to the DB, so they do not use the normal submit post method, and therefore they bypass this tweet mod all together.
Thanks Dragonsys ... but can you imagine any way around this to get it to work ...?

Thanks and great mod!!!
Reply With Quote
  #443  
Old 22 Jun 2010, 19:08
Dragonsys's Avatar
Dragonsys Dragonsys is offline
 
Join Date: Jan 2008
Real name: Eric
Originally Posted by vilhiem View Post
Thanks Dragonsys ... but can you imagine any way around this to get it to work ...?

Thanks and great mod!!!
All i can really suggest is to ask the author's of those mods if they can make them work with this one (or vice versa)
Reply With Quote
  #444  
Old 23 Jun 2010, 06:33
mimocherry mimocherry is offline
 
Join Date: Jun 2010
I got a headache reading through all the posts, and still can not resolve my issue...
I really would like to use bitz.ly, and I think that I have setup the API Key correctly.

however, I still get the following errors..according to other posts, I should use is.gd, but can I use bitzly, and resolve the following issue??

nvalid JSON-response on line 203 in /var/www/vhosts/website/httpdocs/forum/includes/bitly.php
#0 /var/www/vhosts/website/httpdocs/forum/includes/bitly.php(414): Bitly->doCall('shorten', Array)


thanks so muchhhh
Reply With Quote
  #445  
Old 23 Jun 2010, 14:09
Dragonsys's Avatar
Dragonsys Dragonsys is offline
 
Join Date: Jan 2008
Real name: Eric
Originally Posted by mimocherry View Post
I got a headache reading through all the posts, and still can not resolve my issue...
I really would like to use bitz.ly, and I think that I have setup the API Key correctly.

however, I still get the following errors..according to other posts, I should use is.gd, but can I use bitzly, and resolve the following issue??

nvalid JSON-response on line 203 in /var/www/vhosts/website/httpdocs/forum/includes/bitly.php
#0 /var/www/vhosts/website/httpdocs/forum/includes/bitly.php(414): Bitly->doCall('shorten', Array)


thanks so muchhhh
As stated in the OP:

Q: I see an "INVALID_JSON" error

A: Disable bitly by setting $useBitly to false.

This is probably due to JSON being limited or not installed by your webhost. Check you phpinfo and make sure JSON is installed.
Reply With Quote
  #446  
Old 23 Jun 2010, 14:28
mikeo9043 mikeo9043 is offline
 
Join Date: Mar 2008
Can we add more then 1 twitter account?
__________________
Reply With Quote
  #447  
Old 23 Jun 2010, 15:32
mimocherry mimocherry is offline
 
Join Date: Jun 2010
thanks for your kind reply.

1. I do have JSON enabled.
json
json support enabled
json version 1.2.1

2. how do I set $useBitly to false? which file?

thanks!
Reply With Quote
  #448  
Old 23 Jun 2010, 15:56
mimocherry mimocherry is offline
 
Join Date: Jun 2010
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

#okay, I see it now..my god, it is a plugin......I was looking into the bitly.php and twitter.php forever....

sorry, I am new to this..
Reply With Quote
  #449  
Old 23 Jun 2010, 17:22
Dragonsys's Avatar
Dragonsys Dragonsys is offline
 
Join Date: Jan 2008
Real name: Eric
Originally Posted by mimocherry View Post
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

#okay, I see it now..my god, it is a plugin......I was looking into the bitly.php and twitter.php forever....

sorry, I am new to this..
you get it working?
Reply With Quote
  #450  
Old 23 Jun 2010, 17:52
mimocherry mimocherry is offline
 
Join Date: Jun 2010
Okay, I pasted the code as a hook, do I choose new_post_complete as the hook location?

no error message, but nothing happened as well :-(
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 11:23.

Layout Options | Width: Wide Color: