vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.8 Template Modifications (https://vborg.vbsupport.ru/forumdisplay.php?f=236)
-   -   End-User Options - Submit to Twitter, Facebook and Digg (https://vborg.vbsupport.ru/showthread.php?t=217117)

ericgtr 06-24-2009 10:00 PM

Submit to Twitter, Facebook and Digg
 
1 Attachment(s)
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

saadessa 06-25-2009 05:16 PM

nice
thank you

Itchy Nips 06-25-2009 06:34 PM

thanks! One question though: what do you mean by "forumid" ?
sorry for the lack of knowledge...i'm still learning a lot of this stuff

ericgtr 06-25-2009 06:46 PM

Quote:

Originally Posted by Itchy Nips (Post 1837296)
thanks! One question though: what do you mean by "forumid" ?
sorry for the lack of knowledge...i'm still learning a lot of this stuff

No problem. :)

Each forum has a forumid number associated with it. To see which number is associated with which forum go to your Admin CP Forums & Moderators > Forum Manager and click on any forum, on the very top title bar it will give the forumid number.

If you want it visible in all forums you can simply remove the numbers, for example change:

<if condition="in_array($forum['forumid'], array(1,2))">

to

<if condition="in_array($forum['forumid'], array())">

Chimpie 06-25-2009 07:14 PM

Installed and working perfectly! Awesome mod.

Want to take it a step further? Why not make it a drop down box instead of a row of buttons.

Maybe a button or the text Share and you when you click on it a drop down box appears with all the different choices.

Thoughts?

ericgtr 06-25-2009 07:23 PM

Quote:

Originally Posted by Chimpie (Post 1837327)
Installed and working perfectly! Awesome mod.

Want to take it a step further? Why not make it a drop down box instead of a row of buttons.

Maybe a button or the text Share and you when you click on it a drop down box appears with all the different choices.

Thoughts?

Thanks.

I thought about that, it wouldn't be hard but I wanted them easily noticeable.

Chimpie 06-25-2009 07:51 PM

True. Maybe make a second mod or add on to this one for those who want a drop box instead?

Or PM me with it? :cool:

F0xy 06-25-2009 08:14 PM

Quote:

Originally Posted by Chimpie (Post 1837351)
True. Maybe make a second mod or add on to this one for those who want a drop box instead?

Or PM me with it? :cool:

like this
https://vborg.vbsupport.ru/showthread.php?t=187190

Chimpie 06-25-2009 08:51 PM

That looks tacky (to me). I think something as simple as what you have, but with a drop down box with the different icons.

ericgtr 06-25-2009 09:07 PM

1 Attachment(s)
Quote:

Originally Posted by Chimpie (Post 1837351)
True. Maybe make a second mod or add on to this one for those who want a drop box instead?

Or PM me with it? :cool:

Okay, I've put this together for you but check out the screenshot to see what it looks like. The reason for the formatting is because the javascript automatically puts the icons where you see them.

Knowing this, if you want to add it here's what you do...

In the showthread template find:
Code:

<td class="vbmenu_control" id="threadtools" nowrap="nowrap">

Add this above it:
Code:

<!-- social networking menu setup -->
<if condition="in_array($forum['forumid'], array(1,2))">
<else />
        <td class="vbmenu_control" id="share" nowrap="nowrap">
                <a href="$show[nojs_link]#goto_share"<if condition="is_browser('ie')"> accesskey="3"</if>>Share</a>
                <if condition="$show['popups']"><script type="text/javascript"> vbmenu_register("share"); </script></if>
        </td>
</if>
<!-- social networking menu setup -->


Find:
Code:

<!-- thread tools menu -->

Add this above it:
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/twitter_icon.gif" 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"'+'><img src="images/tweet.png"  border="0" alt="Tweet This!" /'+'><'+'/a>');
    </script>
    </td>
        </tr>
        <tr>
                <td class="vbmenu_option" title="nohilite"><img class="inlineimg" src="images/digg_icon.gif" alt="Submit to Digg" /> <script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></td>
        </tr>
        </table>
</div>
<!-- / social networking menu -->


Chimpie 06-25-2009 09:18 PM

I think if you remove the Submit to Twitter and Submit to Digg text it will look perfect.

ericgtr 06-25-2009 09:23 PM

Quote:

Originally Posted by Chimpie (Post 1837404)
I think if you remove the Submit to Twitter and Submit to Digg text it will look perfect.

From what I can tell it's embedded in the javascript which is called from their servers. Take a look at the code and you'll probably see what I mean, that text is not in there.

sugresmax 06-26-2009 06:00 AM

<a href="https://vborg.vbsupport.ru/showthread.php?p=1783648#post1783648" target="_blank">https://vborg.vbsupport.ru/showt...48#post1783648</a> look this

saviola8x 06-26-2009 07:47 PM

i need facebook.
Thanks ^^

Wired1 06-27-2009 06:35 AM

I'd recommend tweaking the optional dropdown a bit so that the button and the description are in different columns within the dropdown. Much cleaner that way IMHO.

Chimpie 06-27-2009 04:30 PM

Quote:

Originally Posted by Wired1 (Post 1838272)
I'd recommend tweaking the optional dropdown a bit so that the button and the description are in different columns within the dropdown. Much cleaner that way IMHO.

I'd say skip the description, just have the icon, and then when you hover the mouse over it then it could say "Share with ... ".

LI_Pets 06-28-2009 11:34 AM

works great, thanks

Morrus 06-28-2009 10:24 PM

Cool mod. Is there any way to get it working with vBSEO?

ericgtr 06-29-2009 01:58 PM

Quote:

Originally Posted by Morrus (Post 1839174)
Cool mod. Is there any way to get it working with vBSEO?

I am using it with VBSEO on my site.

deadlySniper 06-29-2009 03:04 PM

Pretty sweet, thanks.

rrudeboy 06-29-2009 03:45 PM

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 :}

ericgtr 06-29-2009 04:00 PM

Quote:

Originally Posted by rrudeboy (Post 1839653)
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.

rrudeboy 06-29-2009 04:14 PM

Quote:

Originally Posted by ericgtr (Post 1839661)
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..

ericgtr 06-29-2009 04:45 PM

Quote:

Originally Posted by rrudeboy (Post 1839670)
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.

rrudeboy 06-29-2009 05:38 PM

Quote:

Originally Posted by ericgtr (Post 1839693)
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 :}

emailapphost 06-29-2009 05:46 PM

Great mode. Thank you very much - sending good karma your way!

pigsy 07-01-2009 03:27 PM

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.

ericgtr 07-01-2009 03:45 PM

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

pigsy 07-01-2009 03:52 PM

oh nice :)

N-0p3rz 07-01-2009 09:15 PM

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

Thanks

yossie3660 07-02-2009 04:53 AM

i have some error and dunno where i must fix about the code, sometimes successfull, sometimes came like this when i press the button SHARE |F| (the pop up windows came up to share to FB but cannot got the info about thread that i wanna to share) :

(Must be at least 4 characters, letters and numbers only.) Email Address: (We’ll send your password to this address, so triple-check it.)

so....error in where code? cause some times is successful in other thread when i press the button, came with the title post and image from my forum, can u tell me how to fix about this? i use the code from the Thread Starter and my forum using the VBSEO, and about the link to twitter is great, i had tried and successfull but some problem in share to FB.

regards
yossie3660

ericgtr 07-02-2009 01:19 PM

Quote:

Originally Posted by yossie3660 (Post 1841194)
i have some error and dunno where i must fix about the code, sometimes successfull, sometimes came like this when i press the button SHARE |F| (the pop up windows came up to share to FB but cannot got the info about thread that i wanna to share) :

(Must be at least 4 characters, letters and numbers only.) Email Address: (We’ll send your password to this address, so triple-check it.)

so....error in where code? cause some times is successful in other thread when i press the button, came with the title post and image from my forum, can u tell me how to fix about this? i use the code from the Thread Starter and my forum using the VBSEO, and about the link to twitter is great, i had tried and successfull but some problem in share to FB.

regards
yossie3660

I am using VBSEO also and have not had this problem yet but the fact that it works sometimes and not others could mean that there was a problem with the facebook server. Can you duplicate the problem from the same thread every time, or is it intermittent? If it's intermittent then it's most likely on the facebook side.

AzHousePro 07-02-2009 11:59 PM

Had a user call me today and ask for something like this.

Easy to install.

Mike

VonDoom 07-08-2009 11:41 PM

Good Stuff, Always looking for ways the members can help promote. Putting this in there face may work. *Installed*

donwon 07-14-2009 01:34 AM

I read and reread and tried to place the code, but I am showing nothing. I am not sure I am placing the code in the right place. Can you lead a poor site owner to the water? LOL! Thanks.

vivoperdio 07-16-2009 11:22 PM

I would like to ask, can I move the image "http://b.static.ak.fbcdn.net/images/...share_icon.gif" to my own host ?

wptavern 07-17-2009 07:19 AM

Great job on putting this block of code together for easily sharing the content. I know VBulletin already has Digg and StumbleUpon built in but having Twitter as part of the services to share too is key these days. I'm using the drop down menu version and it works a treat.

KevinL 07-17-2009 04:06 PM

Quote:

Originally Posted by donwon (Post 1848373)
I read and reread and tried to place the code, but I am showing nothing. I am not sure I am placing the code in the right place. Can you lead a poor site owner to the water? LOL! Thanks.

Reverse the forumid's put what forums you DON'T want it to show in the ( ) and it will work. For some reason this is what I had to do. I put which forum ID's I wanted it to show in and it didn't show in any forums. So I took the ID's out and it showed just fine. So I reversed it ;)

bposner 07-22-2009 01:52 PM

Nice Mod, installed.

I would like to see something similar someday, but be able to do an inclusive array, not an exclusive one, meaning to be able to select JUST the forums we want this to display rather than entering all the forumids where you don't want it. However I appreciate the free code and will use it and thanks for all the time you put into it. Nice work.

Jerlene 07-31-2009 08:03 AM

FaceBook doesn't have the thread URL.


All times are GMT. The time now is 04:30 PM.

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.01421 seconds
  • Memory Usage 1,862KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (8)bbcode_code_printable
  • (13)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete