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
Submit to Twitter, Facebook and Digg Details »»
Submit to Twitter, Facebook and Digg
Version: 1.00, by ericgtr ericgtr is offline
Developer Last Online: Feb 2022 Show Printable Version Email this Page

Category: End-User Options - Version: 3.8.x Rating:
Released: 06-24-2009 Last Update: Never Installs: 139
Template Edits
Re-useable Code Translations  
No support by the author.

I have been adding these as I go and decided to share, I am sure there are other versions out there but this is how I do it. See screenshot for example of where it goes and how it looks. Keeping up with the latest in social networking keeps traffic flowing to your site.

This can all be added at once or you may add only the one's you want. Additionally, this will probably work in any version of vB.

In the SHOWTHREAD template find:
Code:
<td class="vbmenu_control" id="threadtools" nowrap="nowrap">
Paste this ABOVE:
Code:
<!-- Facebook Share -->
<if condition="in_array($forum['forumid'], array(1,2))">
<else />
<td class="vbmenu_control" id="facebook" nowrap="nowrap">
<script>function fbs_click() {u=location.href;t=document.title;window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;}</script><style> html .fb_share_button { display: -moz-inline-block; display:inline-block; padding:1px 20px 0 5px; height:15px; border:1px solid #d8dfea; background:url(http://b.static.ak.fbcdn.net/images/share/facebook_share_icon.gif?8:26981) no-repeat top right; } html .fb_share_button:hover { color:#fff; border-color:#295582; background:#3b5998 url(http://b.static.ak.fbcdn.net/images/share/facebook_share_icon.gif?8:26981) no-repeat top right; text-decoration:none; } </style> <a href="http://www.facebook.com/share.php?u=<url>" class="fb_share_button" onclick="return fbs_click()" target="_blank" style="text-decoration:none;">Share</a>
</td>
</if>
<!-- / Facebook Share -->
<!-- Twitter Share -->
<if condition="in_array($forum['forumid'], array(1,2))">
<else />
<td class="vbmenu_control" id="twitter" nowrap="nowrap">
<script type="text/javascript">
var twtTitle  = document.title;
var twtUrl    = location.href;
var maxLength = 140 - (twtUrl.length + 1);
if (twtTitle.length > maxLength) {
twtTitle = twtTitle.substr(0, (maxLength - 3))+'...';
}
var twtLink = 'http://twitter.com/home?status='+encodeURIComponent(twtTitle + ' ' + twtUrl);
document.write('<a href="'+twtLink+'" target="_blank"'+'><img src="images/tweet.png"  border="0" alt="Tweet This!" /'+'><'+'/a>');
</script>
</div>
</if>
<!-- / Twitter Share -->
<!-- Digg Share -->
<if condition="in_array($forum['forumid'], array(1,2))">
<else />
<td class="vbmenu_control" id="digg" nowrap="nowrap">
<script type="text/javascript">
digg_url = 'http://www.YOURSITE.com/showthread.php?t=$thread[threadid]';
digg_title = "$threadinfo[title]";
<!-- Change color below to match your forum -->
digg_bgcolor = '#FFFFFF';
digg_skin = 'compact';
digg_window = 'new';
</script>
<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script>
</td>
</if>
<!-- / Digg Share -->
Note the bolded statements above, these are where you must make changes:

enter the forum id's of the forums where you do not want it to show
<if condition="in_array($forum['forumid'], array(1,2))">

You will also see that in the digg section there is an option to change the background color and you will need to add your site URL.

The tweet image is attached, upload to your forum and change the path in the "Twitter Share" section.

Update: This has also been updated to vB4 Beta 3 here https://vborg.vbsupport.ru/showthread.php?t=228610

Screenshots

File Type: jpg networking.jpg (40.4 KB, 0 views)

Show Your Support

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

Comments
  #22  
Old 06-29-2009, 03:45 PM
rrudeboy's Avatar
rrudeboy rrudeboy is offline
 
Join Date: May 2009
Posts: 193
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

using this code for the menu, it's not showing the words "Submit to Twitter"....

Code:
<!-- social networking menu -->
<div class="vbmenu_popup" id="share_menu" style="display:none">
	<table cellpadding="4" cellspacing="1" border="0">
	<tr>
		<td class="thead">Share<a name="goto_share"></a></td>
	</tr>
	<tr>
		<td class="vbmenu_option" title="nohilite"><script>function fbs_click() {u=location.href;t=document.title;window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;}</script><style> html .fb_share_link { padding:2px 0 0 20px; height:16px; background:url(http://b.static.ak.fbcdn.net/images/share/facebook_share_icon.gif?8:26981) no-repeat top left; }</style><a href="http://www.facebook.com/share.php?u=<url>" onclick="return fbs_click()" target="_blank" class="fb_share_link">Share on Facebook</a></td>
	</tr>
	<tr>
		<td class="vbmenu_option" title="nohilite"><img class="inlineimg" src="images/misc/twitter.jpg" alt="Submit to Twitter" /> 
    <script type="text/javascript">
    var twtTitle  = document.title;
    var twtUrl    = location.href;
    var maxLength = 140 - (twtUrl.length + 1);
    if (twtTitle.length > maxLength) {
    twtTitle = twtTitle.substr(0, (maxLength - 3))+'...';
    }
    var twtLink = 'http://twitter.com/home?status='+encodeURIComponent(twtTitle + ' ' + twtUrl);
    document.write('<a href="'+twtLink+'" target="_blank"'+'><'+'/a>');
    </script>
    </td>
	</tr>
	</table>
</div>
<!-- / social networking menu -->
what's wrong with my code ?

tks.

(plus where is it getting the image for FaceBook, it's showing images from my forums like avatars :}
Reply With Quote
  #23  
Old 06-29-2009, 04:00 PM
ericgtr's Avatar
ericgtr ericgtr is offline
 
Join Date: Apr 2003
Location: Portland, Oregon
Posts: 1,407
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by rrudeboy View Post
using this code for the menu, it's not showing the words "Submit to Twitter"....

Code:
<!-- social networking menu -->
<div class="vbmenu_popup" id="share_menu" style="display:none">
	<table cellpadding="4" cellspacing="1" border="0">
	<tr>
		<td class="thead">Share<a name="goto_share"></a></td>
	</tr>
	<tr>
		<td class="vbmenu_option" title="nohilite"><script>function fbs_click() {u=location.href;t=document.title;window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;}</script><style> html .fb_share_link { padding:2px 0 0 20px; height:16px; background:url(http://b.static.ak.fbcdn.net/images/share/facebook_share_icon.gif?8:26981) no-repeat top left; }</style><a href="http://www.facebook.com/share.php?u=<url>" onclick="return fbs_click()" target="_blank" class="fb_share_link">Share on Facebook</a></td>
	</tr>
	<tr>
		<td class="vbmenu_option" title="nohilite"><img class="inlineimg" src="images/misc/twitter.jpg" alt="Submit to Twitter" /> 
    <script type="text/javascript">
    var twtTitle  = document.title;
    var twtUrl    = location.href;
    var maxLength = 140 - (twtUrl.length + 1);
    if (twtTitle.length > maxLength) {
    twtTitle = twtTitle.substr(0, (maxLength - 3))+'...';
    }
    var twtLink = 'http://twitter.com/home?status='+encodeURIComponent(twtTitle + ' ' + twtUrl);
    document.write('<a href="'+twtLink+'" target="_blank"'+'><'+'/a>');
    </script>
    </td>
	</tr>
	</table>
</div>
<!-- / social networking menu -->
what's wrong with my code ?

tks.

(plus where is it getting the image for FaceBook, it's showing images from my forums like avatars :}
There is more code than just that, please check this post again and make sure you add all of the code as instructed https://vborg.vbsupport.ru/showpost....0&postcount=10

It's grabbing the images from Facebook and Digg directly from their sites, the image for Twitter needs to be uploaded to your forum.
Reply With Quote
  #24  
Old 06-29-2009, 04:14 PM
rrudeboy's Avatar
rrudeboy rrudeboy is offline
 
Join Date: May 2009
Posts: 193
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ericgtr View Post
There is more code than just that, please check this post again and make sure you add all of the code as instructed https://vborg.vbsupport.ru/showpost....0&postcount=10

It's grabbing the images from Facebook and Digg directly from their sites, the image for Twitter needs to be uploaded to your forum.
i have the other code in there, but 1. see here screen shot, it's not showing the Twitter text and 2. when the Facebook screen opens it takes images out of the thread, see here: screen shot..
Reply With Quote
  #25  
Old 06-29-2009, 04:45 PM
ericgtr's Avatar
ericgtr ericgtr is offline
 
Join Date: Apr 2003
Location: Portland, Oregon
Posts: 1,407
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by rrudeboy View Post
i have the other code in there, but 1. see here screen shot, it's not showing the Twitter text and 2. when the Facebook screen opens it takes images out of the thread, see here: screen shot..
It looks like you've modified the twitter code a little bit which is causing the text not to display. However, you have the link there so you can probably just manually add the text as you like.

As for Facebook taking images from the thread, it does that by default but you can check no image and it will ignore it.
Reply With Quote
  #26  
Old 06-29-2009, 05:38 PM
rrudeboy's Avatar
rrudeboy rrudeboy is offline
 
Join Date: May 2009
Posts: 193
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ericgtr View Post
It looks like you've modified the twitter code a little bit which is causing the text not to display. However, you have the link there so you can probably just manually add the text as you like.

As for Facebook taking images from the thread, it does that by default but you can check no image and it will ignore it.
thanks, fixed the Twitter link... re. the image, well i guess it is what it is :}
Reply With Quote
  #27  
Old 06-29-2009, 05:46 PM
emailapphost emailapphost is offline
 
Join Date: Oct 2008
Posts: 88
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Great mode. Thank you very much - sending good karma your way!
Reply With Quote
  #28  
Old 07-01-2009, 03:27 PM
pigsy pigsy is offline
 
Join Date: Nov 2001
Posts: 61
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Can the url automatically be shortened using one of the services that does that - I've seen a mod for wordpress that does that. I'd definitely want to use this then.
Reply With Quote
  #29  
Old 07-01-2009, 03:45 PM
ericgtr's Avatar
ericgtr ericgtr is offline
 
Join Date: Apr 2003
Location: Portland, Oregon
Posts: 1,407
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Are you referring to the Twitter section? It changes the URL automatically upon submission.

For example, when I click the twitter button in this link http://www.politicalgroove.com/news/...es-u-turn.html the it grabs the post title and the URL and looks like this (in the box before you submit):

north korean ship does a u-turn - PoliticalGroove Forums http://www.politicalgroove.com/news/...es-u-turn.html

Then after you submit, it automatically changes the URL to shorten it, like this:

http://bit.ly/OH0tU
Reply With Quote
  #30  
Old 07-01-2009, 03:52 PM
pigsy pigsy is offline
 
Join Date: Nov 2001
Posts: 61
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

oh nice
Reply With Quote
  #31  
Old 07-01-2009, 09:15 PM
N-0p3rz's Avatar
N-0p3rz N-0p3rz is offline
 
Join Date: Aug 2003
Location: San Antonio, TX
Posts: 81
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nice mod, using the second one. Scrapped the digg button & kept Facebook & Twitter, works like a charm after some modification to images.

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 01:10 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.04991 seconds
  • Memory Usage 2,349KB
  • 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
  • (4)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
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (1)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