Description
This modification adds basic Twitter integration to vBulletin. Once a user defines their Twitter username & password within their vB Options (User CP -> Edit Options), the Tweet This X links will appear.
It automatically adds a tweet to their account with the default text of "Check this out! " (which can be edited editing the "twitter_checkout" phrase) and uses your forum URL with either tp or tt.php as the link. These redirect to the thread / post that was tweeted.
Installation- Upload files in the /upload/ folder of the .zip into the directories as is.
- Install product file.
- Register an OAuth Application https://twitter.com/oauth_clients, using:
- Application Name: Your Site!
- Description: Site Integration into Twitter.
- (I request this one not be changed!) Application Website: vBTwitter
- Website: Your URL!
- Application Type: Browser
- (change url) Callback URL: http://www.yoururl.com/twitter_auth.php
- Default Access type: Read & Write
- Click Install on vB.org
- Tell Your users.
- Enjoy
Upgrading to v1.0.4- Upload all files, overwrite everything.
- Install product file.
- Register an OAuth Application https://twitter.com/oauth_clients, using:
- Application Name: Your Site!
- Description: Site Integration into Twitter.
- (I request this one not be changed!) Application Website: vBTwitter
- Website: Your URL!
- Application Type: Browser
- (change url) Callback URL: http://www.yoururl.com/twitter_auth.php
- Default Access type: Read & Write
- Gain and copy the Consumer Key & Secret into vBulletin Options.
Upgrading to v1.0.3 or before.- Upload all files, overwrite everything.
- install product file.
- Remove template edits. For the record, they are here:
- Open the postbit or postbit_legacy template (depending on what you use). Find:
HTML Code:
<if condition="$show['postcount']">#<a href="showpost.php?$session[sessionurl]p=$post[postid]&postcount=$post[postcount]" target="new" rel="nofollow" id="postcount$post[postid]" name="$post[postcount]"><strong>$post[postcount]</strong></a></if>
Add before that:
HTML Code:
<if condition="$post['twitter_username']"><a href="tweet.php?do=post&id=$post[postid]&c=$post[postid]">Tweet this post!</a></if>
- Open the SHOWTHREAD template.
Find:
HTML Code:
<if condition="$show['addpoll']">
<tr>
<td class="vbmenu_option"><img class="inlineimg" src="$stylevar[imgdir_button]/addpoll.gif" alt="$vbphrase[add_a_poll]" /> <a href="poll.php?$session[sessionurl]do=newpoll&t=$threadinfo[threadid]">$vbphrase[add_a_poll_to_this_thread]</a></td>
</tr>
</if>
Add After:
HTML Code:
<if condition="$vbulletin->userinfo['twitter_username']">
<tr>
<td class="vbmenu_option">
<a href="tweet.php?do=thread&id=$threadinfo[threadid]">Tweet This Thread!</a>
</td>
</tr>
</if>
Find:
HTML Code:
<if condition="!$show['search_engine']">
<div><img class="inlineimg" src="$stylevar[imgdir_button]/printer.gif" alt="$vbphrase[show_printable_version]" vspace="1" /> <a href="printthread.php?$session[sessionurl]t=$threadid" rel="nofollow">$vbphrase[show_printable_version]</a></div>
<div><img class="inlineimg" src="$stylevar[imgdir_button]/sendtofriend.gif" alt="$vbphrase[email_this_page]" vspace="1" /> <a href="sendmessage.php?$session[sessionurl]do=sendtofriend&t=$threadid" rel="nofollow">$vbphrase[email_this_page]</a></div>
</if>
Add After:
HTML Code:
<if condition="$vbulletin->userinfo['twitter_username']"><a href="tweet.php?do=thread&id=$threadinfo[threadid]">Tweet This Thread!</a></if>
Requirements
THIS MODIFICATION REQUIRES PHP 5 DUE TO THE CLASS THAT IS USED!
PHP'S CURL EXTENSION IS ALSO USED! THE API CALLS ARE COMPLETELY DEPENDENT ON THEM!
This modification should work on vBulletin v3.5+, but was only tested on a vB 3.8 install.
Using the "tp.php" switch added in v1.0.2
With the release of v1.0.2, a switch between showpost.php?p=ID&postcount=COUNT and showthread.php?p=ID#postID has been added. Using it is simple, but requires a code edit (Note: This is a SUPPORTED code edit!). Open up tp.php and find this line:
PHP Code:
define('SHOWPOST', true);
Change that line to this:
PHP Code:
define('SHOWPOST', false);
This will automatically trigger the change any time it is loaded. This works
retroactively and any links will automatically use the new settings once changed!