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 115 22 Feb 2013 23:02

  #151  
Old 07 Feb 2010, 09:33
buro9 buro9 is offline
 
Join Date: Feb 2002
Originally Posted by nekiw View Post
is it possible to make it work for only articles from CMS portal ?
Originally Posted by newmomsforum View Post
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
Originally Posted by Chicken Racer View Post
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.

Originally Posted by Boko577 View Post
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.
Reply With Quote
  #152  
Old 07 Feb 2010, 10:16
I.am I.am is offline
 
Join Date: Mar 2009
Originally Posted by Videx View Post
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
Reply With Quote
  #153  
Old 07 Feb 2010, 16:01
Uberguilds Uberguilds is offline
 
Join Date: Jun 2006
Originally Posted by Boko577 View Post
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.
Reply With Quote
  #154  
Old 07 Feb 2010, 23:18
delmarva's Avatar
delmarva delmarva is offline
 
Join Date: Jun 2006
Originally Posted by kefallon View Post
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.
Reply With Quote
  #155  
Old 07 Feb 2010, 23:32
redhawk89 redhawk89 is offline
 
Join Date: Dec 2008
Can this be made into a product?
Reply With Quote
  #156  
Old 08 Feb 2010, 02:37
Videx's Avatar
Videx Videx is offline
 
Join Date: Feb 2007
Originally Posted by delmarva View Post
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?
Reply With Quote
  #157  
Old 08 Feb 2010, 16:18
Robru's Avatar
Robru Robru is offline
 
Join Date: Aug 2005
Perfect Mod, thanks !!!
Reply With Quote
  #158  
Old 08 Feb 2010, 17:56
sqzdog sqzdog is offline
 
Join Date: Apr 2005
Is there a way to tweet new posts, instead of just new threads?
Reply With Quote
  #159  
Old 08 Feb 2010, 18:09
sqzdog sqzdog is offline
 
Join Date: Apr 2005
Question

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 :
Reply With Quote
  #160  
Old 09 Feb 2010, 07:31
TyPenn613 TyPenn613 is offline
 
Join Date: Dec 2006
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!
Reply With Quote
  #161  
Old 09 Feb 2010, 10:52
is_it_me is_it_me is offline
 
Join Date: Mar 2009
Thumbs up

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!
Reply With Quote
  #162  
Old 09 Feb 2010, 11:39
thisgeek thisgeek is offline
 
Join Date: Dec 2005
Originally Posted by tenjinzan View Post
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.
Originally Posted by thisgeek View Post
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?
Reply With Quote
  #163  
Old 09 Feb 2010, 19:17
TyPenn613 TyPenn613 is offline
 
Join Date: Dec 2006
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
Reply With Quote
  #164  
Old 09 Feb 2010, 19:20
Bob_R Bob_R is offline
 
Join Date: Jun 2009
Looks like I'll be installing this. Too bad there's not a vBulletin to Facebook as well.
Reply With Quote
  #165  
Old 09 Feb 2010, 19:38
redhawk89 redhawk89 is offline
 
Join Date: Dec 2008
not working with vbseo
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 20:54.

Layout Options | Width: Wide Color: