Go Back   vb.org Archive > vBulletin Modifications > vBulletin 3.8 Modifications > vBulletin 3.8 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: 3.8.x Rating:
Released: 08-13-2010 Last Update: 08-20-2010 Installs: 57
Template Edits
Re-useable Code Translations  
No support by the author.

Twitter released their new TWEET button.

Live Demo: http://www.juot.net/forums/showthread.php?t=41185
(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 / 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 Now

File Type: txt tweet_button_vb3.txt (2.3 KB, 151 views)

Screenshots

File Type: jpg ss_twitter.jpg (180.2 KB, 0 views)
File Type: jpg ss_twitter_badic.jpg (82.3 KB, 0 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.
Благодарность от:
mary_rose082198

Comments
  #52  
Old 02-22-2011, 07:49 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I recommend using this line for the Twitter code, you'll note it has the data-url attribute the original code does not. This will force Twitter to count and link to the page via a single URL- it will not vary based on how the user is browsing the page...

Code:
<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>
Reply With Quote
  #53  
Old 03-18-2011, 06:51 AM
Judger21 Judger21 is offline
 
Join Date: Aug 2008
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for posting this! Took me awhile to get it where I wanted it (put it in my postbit legacy) and getting it lined up.
Reply With Quote
  #54  
Old 03-21-2011, 12:58 AM
SVTCobraLTD SVTCobraLTD is offline
 
Join Date: Jul 2007
Location: PA
Posts: 841
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

How do you install this next to Thread Tools like the Demo Site?
Reply With Quote
  #55  
Old 03-21-2011, 01:50 AM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

To do it next to thread tools like currently in the demo (March 2011):

Edit SHOWTHREAD template...

FIND the code below and ADD the code in RED

Code:
	<td class="tcat" width="100%">
		<div class="smallfont">
		<if condition="$show['firstunreadlink']">
			<a href="$firstunread"><img class="inlineimg" src="$stylevar[imgdir_button]/firstnew.gif" alt="$vbphrase[view_first_unread]" border="0" /></a>
			<a href="$firstunread"><strong>$vbphrase[view_first_unread]</strong></a>
		</if>
		&nbsp;
		</div>
	</td>
       
   <td class="vbmenu_control" id="threadshare" nowrap="nowrap">
------TWITTER CODE HERE-----
       </td>

	<td class="vbmenu_control" id="threadtools" nowrap="nowrap">
		<a href="$show[nojs_link]#goto_threadtools"<if condition="is_browser('ie')"> accesskey="3"</if>>$vbphrase[thread_tools]</a>
		<if condition="$show['popups']"><script type="text/javascript"> vbmenu_register("threadtools"); </script></if>
	</td>
Reply With Quote
  #56  
Old 03-21-2011, 02:27 AM
SVTCobraLTD SVTCobraLTD is offline
 
Join Date: Jul 2007
Location: PA
Posts: 841
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you, got it working.
Reply With Quote
  #57  
Old 07-06-2011, 07:34 AM
weindians weindians is offline
 
Join Date: Sep 2006
Posts: 130
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by BirdOPrey5 View Post
The only thing to try is to add the data-url line to the code, for example:
Code:
<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>
That helps for some people. Facebook has a similar option I know too, to manually specify the URL to be counted.
still count is same 0.. i have vbseo is that coz this workaround not doing anything???
Reply With Quote
  #58  
Old 07-06-2011, 11:31 AM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I don't have access to VBSEO sorry. You can disable the count from showing by changing data-count="horizontal" to data-count="none" in the code. Another option would be to ask in the VBSEO forum if anyone has the tweet button working. This is just the standard install instructions from Twitter, there's not much I can do about it.
Reply With Quote
  #59  
Old 07-17-2012, 02:40 AM
Froggy32701 Froggy32701 is offline
 
Join Date: Aug 2005
Posts: 31
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by BirdOPrey5 View Post
If you add this to postbit legacy you'd be tweeting single posts, not threads... but if you really want to...

In Postbit Legacy Find:
Code:
 <!-- controls -->
And directly below it add:
Code:
<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-url="http://www.juot.net/forums/showthread.php?$session[sessionurl]p=$post[postid]&amp;postcount=$post[postcount]" data-via="YOUR_TWITTER_USERNAME">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
Change http://www.juot.net/forums/ to your forum's URL, whatever would come before showpost.php... and change YOUR_TWITTER_USERNAME to your twitter username... this will put the tweet button right next to the Quote button and it lines up well, I tested it. It also sends the right URL to twitter.
BOP5

Doing this is going to post the link for viewing a single post correct?

If yes, is there a way to do this so that you can tweet the single post but instead of the link taking you to the view single post it takes you to the section of the thread that has that post?

Hope that makes sense..

EDIT:

Never mind figured it out on my own..
Reply With Quote
  #60  
Old 11-25-2012, 07:04 PM
al2thero al2thero is offline
 
Join Date: Aug 2008
Posts: 72
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks!
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 06:49 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07658 seconds
  • Memory Usage 2,344KB
  • Queries Executed 27 (?)
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
  • (9)bbcode_code
  • (2)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
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (1)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (3)postbit_attachment
  • (10)postbit_onlinestatus
  • (10)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_postinfo_query
  • fetch_postinfo
  • 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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • 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