Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Template Modifications
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Twitter - Tweet Button in SHOWTHREAD Details »»
Twitter - Tweet Button in SHOWTHREAD
Version: 1.00, by BirdOPrey5 (Senior Member) BirdOPrey5 is offline
Developer Last Online: Aug 2023 Show Printable Version Email this Page

Category: Show Thread Enhancements - Version: 4.0.x Rating:
Released: 08-13-2010 Last Update: 08-20-2010 Installs: 146
Template Edits
Re-useable Code Translations  
No support by the author.

This mod is now outdated and as a result support for new installs will be limited, if any.

-July 7, 2011-

Please instead use my new mod which offers Twitter and many more share options for VB 4.x without template edits.

WARNING - It appears vBulletin has changed the location of the Facebook Like button in version 4.1.2. As a result it is likely the code changes below will be different in 4.1.2 and beyond, I will not be able to support installs beginning with version 4.1.2 since my license stops at 4.0.8.


Twitter released their new TWEET button.

Live Demo: http://www.juot.net/forums/showthread.php?t=41185
(Note my Live Board is VB 3.8, but I have tested this on 4.0.4 and 4.0.6)
(Update I have for the time being replaced the Tweet button with the Add This share button on my live forum. See the screen shots instead.)

I have tested this in latest versions of IE / Firefox / Chrome / Safari / Opera and it should work in all.

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

If you DO NOT use the built-in Facebook Like button do the following:

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

Find: (The first instance of)
Code:
		<vb:if condition="$pagenav">
			{vb:raw pagenav}
		</vb:if>
Above this add:
Code:
<vb:if condition="!in_array($GLOBALS[forumid], array(X, Y, Z))">
<div id="mytweetbutton" align="right" style="height:27px;">
<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>
</div>
</vb:if>
Change the X, Y, Z in the first 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:
<vb:if condition="!in_array($GLOBALS[forumid], array(2, 5, 9))">
<vb:if condition="!in_array($GLOBALS[forumid], array(7))">
<vb: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:
<vb:if condition="!in_array($GLOBALS[forumid], array(X, Y, Z))">
and 
</vb:if>
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.

If you DO USE the built-in Facebook Like button do the following:

Find:
Code:
		{vb:raw fblikebutton}
Replace it with:
Code:
<div id="fb_likeframe" style="border: none; overflow: hidden; height: 27px; width: 95px; vertical-align: text-bottom; padding-top:1px;"><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></div>{vb:raw fblikebutton}
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.

The Tweet button will now show up next to the Facebook Like button in anytime the Facebook Like button is displayed in a thread.

----

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. For other options including the button with no counter visit: http://twitter.com/goodies/tweetbutton

The screen shots show the Tweet button both with and without the page navigation bar, and with the Facebook Like button.

Please click Install if you use this.

Download the .txt file for a copy of the install instructions. :up:

----

Known Issues- a few people have reported a 'slash' is missing in the URL submitted to Twitter on some boards. Other people have said URL's with non-english characters cause a URL error. The solution for both of these issues is in post #143 in this thread.

Also Twitter appears to be having widespread issues with the counter not working. Some sites it works, some it don't, sometimes it stops working, sometimes it starts working for no reason. If you find your count isn't working try the solution in post #147. If that doesn't work than disable your counter completely if you want by changing the word "horizontal" to "none" in the twitter code.

Download Now

File Type: txt tweet_button_vb4.txt (3.3 KB, 313 views)

Screenshots

File Type: jpg ss_tweet_vb4-1.jpg (91.2 KB, 0 views)
File Type: jpg ss_tweet_vb4-2.jpg (64.6 KB, 0 views)
File Type: jpg ss_tweet_vb4-3.jpg (71.9 KB, 0 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #22  
Old 08-15-2010, 06:35 PM
acezakj acezakj is offline
 
Join Date: May 2010
Posts: 45
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Could you make a identical facebook one right next to the twitter one? It would be greatly appreciated
Reply With Quote
  #23  
Old 08-15-2010, 07:12 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Doesn't VB4 have facebook integration built in already? You just go to the admin cp -> vbulletin options -> Facebook Options to set it up...

If you are using VB3.x then I recommend this mod, it's what I use in my 3.8 board:
https://vborg.vbsupport.ru/showthread.php?t=243319

For the most part it would work on VB4 if it had to, just put the code in SHOWTHREAD so you don't need those conditionals.
Reply With Quote
  #24  
Old 08-17-2010, 06:02 AM
Gleedo Gleedo is offline
 
Join Date: Oct 2008
Posts: 157
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by CMSTemplateZ View Post
Thanks bud for a quick reply... i worked it out.... See Here: http://battlefield3forums.com/content/

I added it to the start of the breadcrumb div and wrapped it in my own custom div to style it a little better... because the facebook like text color can not be changed it's kinda hard to see i will keep playing around with it.

Thanks for this, just hope people still click these buttons, now that every site seems to have them numbers have dropped alot, hopefully the tweet button gets people clicking it.

Cheers again for posting this
I clicked your tweet button as im a member of your forum
Reply With Quote
  #25  
Old 08-18-2010, 04:50 AM
sbsforum.us sbsforum.us is offline
 
Join Date: Feb 2009
Posts: 76
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks
Reply With Quote
  #26  
Old 08-18-2010, 11:57 AM
zelnik zelnik is offline
 
Join Date: Aug 2008
Posts: 374
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by BirdOPrey5 View Post
Honestly I don't have Facebook integration installed on mine so that might be what is causing the problem... however zurrie reported changing the div height to 50 seemed to fix this problem.
It does work but it bloats the display too much as it goes above the FB and page 123 select.

Look forward to you having 4.0.6 installed and turning on the fb as it will be a lovely addition to my site!

Thanks!
Reply With Quote
  #27  
Old 08-18-2010, 08:09 PM
Crowza Crowza is offline
 
Join Date: Feb 2010
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Here is what I did to fix the sizing issues for 4.0.6:

1. Find the following code in SHOWTHREAD:

Code:
<vb:if condition="$show['fb_likebutton']">
2. After that line insert your Twitter button code:

Code:
<vb:if condition="!in_array($GLOBALS[forumid], array(21, 22))">    
                                  <div id="mytweetbutton" align="right" style="height:15px;">
                                  <a href="http://twitter.com/share" class="twitter-share-button" data-count="none" data-via="crowzacom" data-related="EdCrowza">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
                                  </div>
                           </vb:if>
3. Make sure you replace the correct variables, per the original instructions (I also added the 'data-related' option for it to recommend more than one Twitter account). Notice, the height is set to '15px;'.

If you do that, it should look like the attached image:
Attached Images
File Type: png tweet.png (7.8 KB, 0 views)
Reply With Quote
  #28  
Old 08-19-2010, 01:39 PM
zelnik zelnik is offline
 
Join Date: Aug 2008
Posts: 374
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Crowza View Post
Here is what I did to fix the sizing issues for 4.0.6:

1. Find the following code in SHOWTHREAD:

Code:
<vb:if condition="$show['fb_likebutton']">
2. After that line insert your Twitter button code:

Code:
<vb:if condition="!in_array($GLOBALS[forumid], array(21, 22))">    
                                  <div id="mytweetbutton" align="right" style="height:15px;">
                                  <a href="http://twitter.com/share" class="twitter-share-button" data-count="none" data-via="crowzacom" data-related="EdCrowza">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
                                  </div>
                           </vb:if>
3. Make sure you replace the correct variables, per the original instructions (I also added the 'data-related' option for it to recommend more than one Twitter account). Notice, the height is set to '15px;'.

If you do that, it should look like the attached image:
thanks for that is there anyway to get it next to the fb like button?
Reply With Quote
  #29  
Old 08-20-2010, 09:30 PM
xtremecoders xtremecoders is offline
 
Join Date: May 2010
Posts: 32
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nice MOD but i have also Facebook enabled and causing some Overlap with pages display.



UPDATE....

Fixed by Changing Possition of code.....

1. Find the following code in SHOWTHREAD:

Code:
            <div id="postpagestats_above" class="postpagestats">
                {vb:rawphrase showing_results_x_to_y_of_z, {vb:raw pagenumbers.first}, {vb:raw pagenumbers.last}, {vb:raw totalposts}}
            </div>
2. After that line insert your Twitter button code:

Code:
<vb:if condition="!in_array($GLOBALS[forumid], array(X, Y, Z))">
<div id="mytweetbutton" align="right" style="height:50px;">
<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>
</div>
</vb:if>


Reply With Quote
  #30  
Old 08-21-2010, 08:51 AM
zelnik zelnik is offline
 
Join Date: Aug 2008
Posts: 374
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by xtremecoders View Post
Fixed by Added bellow.....
Unfortunately that doesn't fix it properly, the pagination is not correct as the " Results 1 to 10 of 17" should be next to the pagination and now it is under the facebook connect.

Also it looks a little odd as it doesn't line up (twit button) should be a couple of pixels higher or ultimately it would look better next to the fb icon I think...

Have a look at the attachments to see what I mean.
Attached Images
File Type: png before.png (4.1 KB, 0 views)
File Type: png notworking.png (7.5 KB, 0 views)
Reply With Quote
  #31  
Old 08-21-2010, 09:05 AM
xtremecoders xtremecoders is offline
 
Join Date: May 2010
Posts: 32
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Why for me is Just fine ?



Maybe you don't place it at the right place.
Place the code after the first </div>, NOT the second....
Reply With Quote
Reply


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

Forum Jump


All times are GMT. The time now is 12:27 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04891 seconds
  • Memory Usage 2,366KB
  • Queries Executed 26 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (11)bbcode_code
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (7)postbit_attachment
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete