Back to vBulletin 3.8 Template Modifications

Twitter - Tweet Button in SHOWTHREAD
Mod Version: 1.00, by BirdOPrey5

vB Version: 3.8.x Rating: (5 votes - 4.80 average) Installs: 57
Released: 14 Aug 2010 Last Update: 22 Aug 2010 Downloads: 149
Not Supported Template Edits Re-usable Code Translations External Content  

Twitter released their new TWEET button.

Live Demo: http://www.juot.net/forums/index.php?t=41185
(Update I have for the time being replaced the Tweet button with the http://www.addthis.com share button on my live forum. See the screen shots instead.)

I have tested this in latest versions of IE / Firefox / Chrome / Opera / Safari.

This will show you how to add this simple code to your SHOWTHREAD template below the page navigation bar, if visible.

Go to the Admin CP -> Styles & Templates -> Style Manager
Edit your SHOWTHREAD Template

Find:
Code:
<if condition="$show['pagenav']"><td align="$stylevar[right]">$pagenav</td></if>
Replace With:
Code:
<td align="$stylevar[right]"><if condition="$show['pagenav']">$pagenav</if>
<if condition="!in_array($GLOBALS[forumid], array(X, Y, Z))">
<table border="0">
<tr><td>
<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-via="YOUR_TWITTER_USERNAME">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
</td></tr></table>
</if>
</td>
Change the X, Y, Z in the second line to the forumid's of any private forums you may have. If a guest can't view a forum there is no reason to link a tweet to it. You can add as many or as few forumid's here as you need, just separate each with a comma.
Valid Examples:
<if condition="!in_array($GLOBALS[forumid], array(2, 5, 9))">
<if condition="!in_array($GLOBALS[forumid], array(7))">
<if condition="!in_array($GLOBALS[forumid], array(2, 3, 4, 5, 6, 7, 8))">
If none of your forums are private or you want to enable this in every forum you can remove the lines:
Code:
<if condition="!in_array($GLOBALS[forumid], array(X, Y, Z))">
and 
</if> (The second one)
Replace "YOUR_TWITTER_USERNAME" with your twitter username, it will be referenced in the tweet- but the tweet will not be from YOU, it will be from whoever hits the tweet button.

When you hit the Tweet button you will be given a box to type a message if you're logged in. If you're not logged in you will be asked to login or join, all within the pop-up window.

This button code will count the number of tweets people have made using it. I will add more options in later posts.

Note- My Screenshot also has the Facebook Like button available as a separate mod here by someone else. If you don't have the facebook like button your Tweet button will be on the right of the page. There is also a basic skin screen shot.

Please click Install if you use this.

NEW UPDATE!!!

Use this code instead it will force the correct URL to Twitter and solve the issue with a different URL being tweeted if thread is tweeted as soon as it's posted.

Code:
<td align="$stylevar[right]"><if condition="$show['pagenav']">$pagenav</if>
<if condition="!in_array($GLOBALS[forumid], array(X, Y, Z))">
<table border="0">
<tr><td>
<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-via="YOUR_TWITTER_USERNAME" data-url="$vboptions[bburl]/showthread.php?t=$thread[threadid]">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
</td></tr></table>
</if>
</td>
Be sure to replace "YOUR_TWITTER_USERNAME" and "X, Y, Z" as described above.

Download

File Type: %1$s tweet_button_vb3.txt (2.3 KB, 153 downloads)

Screenshots

Click image for larger version
Name:	ss_twitter.jpg
Views:	1154
Size:	180.2 KB
ID:	120800   Click image for larger version
Name:	ss_twitter_badic.jpg
Views:	902
Size:	82.3 KB
ID:	120801  

Similar Mods

Mini Mods Facebook - Linkhay - Tweet - Yahoo Buzz Share with Above Button Cool vBulletin 4.x Template Modifications

vblts.ru supports vBulletin®, 2022-2024