Go Back   vb.org Archive > vBulletin Modifications > vBulletin 3.8 Modifications > vBulletin 3.8 Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Add Facebook "Like" button to your threads [vB 3.8.x] Details »»
Add Facebook "Like" button to your threads [vB 3.8.x]
Version: 1.00, by hubie hubie is offline
Developer Last Online: Jun 2013 Show Printable Version Email this Page

Category: Add-On Releases - Version: 3.8.x Rating:
Released: 04-22-2010 Last Update: Never Installs: 225
Template Edits
 
No support by the author.

This mod is based on this, but working on vB 3.8.x.

As was said there: Facebook has just launched their latest "Like" button to developers to use on any site. What this does is utilizes the Advertising module to add the "Like" button to the first post of each thread. Please see screenshots to get an idea.

DEMO

IFrame Method

There is two kind of "Like" button (IFrame Method):

- With a smallest counter at his side *
Code:
<iframe src="http://www.facebook.com/plugins/like.php?href=http://www.YOURSITE.com/showthread.php$session[sessionurl]?p=$post[postid]&amp;layout=button_count&amp;show_faces=true&amp;width=&amp;action=like&amp;colorscheme=light" 
scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:100px; height:20px"></iframe>

- With a largest counter (and names of people who have clicked) *
Code:
<iframe src="http://www.facebook.com/widgets/like.php?href=http://www.YOURSITE.com/showthread.php$session[sessionurl]?p=$post[postid]&amp;show_faces=false&amp
        scrolling="no" frameborder="0" 
        style="border:none; width:450px; height:25px"></iframe>
*Change show_faces=false for true if you want to see faces

Installation:

Go to your Postbit/Postbit Legacy template and search for:
Code:
<!-- controls -->
And add below the code that you previously selected according your favorite button style.

If you want that the button only appears in first post of a thread, add this variables at the beginning and end of the code that you previously selected:
Code:
<if condition="$post[postcount] == 1">YOUR CODE</if>
*You should add these variables, otherwise the button will be displayed in every post, which makes no sense.



XFBML Method (recommended)
This is a richer way to send the contents of your board to Facebook, because it gives to users the possibility to add more information and also an image of your site is displayed on their FB wall (see the screenshots below).

Installation: (provided by cdoyle, thanks mate :up

You'll need to register your app here: http://developers.facebook.com/setup/, and get an ID to place into the code below.

Code:
<if condition="$post[postcount] == 1 AND !in_array($GLOBALS[forumid], array(40, 39))">


<p><fb:like></fb:like></p>

<div id="fb-root"></div>
    <script>
      window.fbAsyncInit = function() {
        FB.init({appId: 'yourappID', status: true, cookie: true,
                 xfbml: true});
      };
      (function() {
        var e = document.createElement('script');
        e.type = 'text/javascript';
        e.src = document.location.protocol +
          '//connect.facebook.net/en_US/all.js';
        e.async = true;
        document.getElementById('fb-root').appendChild(e);
      }());
    </script>


</if>
-----------------------------------------------------------------------------------------------------

Internet Explorer browser fix: https://vborg.vbsupport.ru/showpost....5&postcount=70

-----------------------------------------------------------------------------------------------------

For additional information on this button and different parameters please visit http://developers.facebook.com/docs/...e/plugins/like

Remember to click Mark as Installed if you use this modification :up:

Download Now

File Type: txt Facebook Like Button.txt (1.3 KB, 1380 views)

Screenshots

File Type: jpg faceb1.jpg (41.1 KB, 0 views)
File Type: jpg faceb2.jpg (6.9 KB, 0 views)
File Type: jpg faceb3.jpg (32.8 KB, 0 views)
File Type: jpg fbk1.jpg (17.4 KB, 0 views)
File Type: jpg fbk2.jpg (28.4 KB, 0 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.
3 благодарности(ей) от:
Drhago, TheLegendB, yasser4101

Comments
  #112  
Old 07-22-2010, 11:37 AM
alehawk alehawk is offline
 
Join Date: Apr 2008
Posts: 65
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ah yes, I got it, it may be that... tnx 4 the reply!
Reply With Quote
  #113  
Old 07-25-2010, 04:46 AM
ram94401 ram94401 is offline
 
Join Date: Dec 2007
Posts: 49
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you hubie. I added like button next to Post Reply button in each thread. I like it this way instead of placing the like button after first post. Like button is more prominent if you place it in the top of thread -- just my thought.

I modfied showthread template. Find

Code:
<td class="smallfont"><a 

href="newreply.php?$session[sessionurl]do=newreply&amp;noquote=1&amp;p=$FIRSTPOSTID" 

rel="nofollow">
and create another td element after this td; place the iframe tag between the new td tags.

To see how it looks, see http://www.digitalbhoomi.in/forums/.

Complete code:

Code:
<table cellpadding="0" cellspacing="0" border="0" width="100%" style="margin-bottom:3px">
<tr valign="bottom">
	<if condition="$show['largereplybutton']">
	<td width="120px;" valign="top" class="smallfont"><a href="newreply.php?$session[sessionurl]do=newreply&amp;noquote=1&amp;p=$FIRSTPOSTID" rel="nofollow"><if condition="$show['closethread']"><img src="$stylevar[imgdir_button]/reply.gif" alt="$vbphrase[reply]" border="0" /><else /><img src="$stylevar[imgdir_button]/threadclosed.gif" alt="$vbphrase[closed_thread]" border="0" /></if></a>
        </td>
        <td>
        <iframe scrolling="no" frameborder="0" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.digitalbhoomi.in/forums/showthread.php?t=$thread[threadid]&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=30" style="border: medium none; overflow: hidden; width: 450px; height: 30px;" allowtransparency="true"></iframe>
        </td>	
	
        <else />
I used iframe instead of xfbml. The reason is that xfbml needs Javascript SDK which mess up with flash ads in the page. Facebook has a solution for this, but it's not working. Moreover, I don't want to add too many javascripts in the forum page that will slow down the page loading.
Reply With Quote
  #114  
Old 08-06-2010, 12:56 PM
soundbarrierpro soundbarrierpro is offline
 
Join Date: Nov 2007
Posts: 767
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Anybody knows how this will work with vbSEO? How would you change standard URL format to SEO urls?

ex. http://www.mysite.com/forum-name/topic-name.html

?

Thank you
Reply With Quote
  #115  
Old 08-07-2010, 02:12 PM
ram94401 ram94401 is offline
 
Join Date: Dec 2007
Posts: 49
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by soundbarrierpro View Post
Anybody knows how this will work with vbSEO? How would you change standard URL format to SEO urls?

ex. http://www.mysite.com/forum-name/topic-name.html

?

Thank you
For Like URL, you dont need to optimize it for SEs. If you want to do it, I guess it may not be too difficult. Find the variable for forum name and topic name and format it the way you want it.
Reply With Quote
  #116  
Old 08-07-2010, 07:33 PM
soundbarrierpro soundbarrierpro is offline
 
Join Date: Nov 2007
Posts: 767
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ram94401 View Post
For Like URL, you dont need to optimize it for SEs. If you want to do it, I guess it may not be too difficult. Find the variable for forum name and topic name and format it the way you want it.
The URL added to my FB page isn't a direct link to the topic I "like". Instead since my URL's are SEO'd, the link added on facebook is just my domain name. If a facebook friend clicks the link that was liked, it just goes to my base domain URL, not the topic.

I need to know how I can code http://www.YOURSITE.com/showthread.php$session[sessionurl]?p=$post[postid]&amp;show_faces=false&amp

To be an SEO’d URL
Reply With Quote
  #117  
Old 08-07-2010, 08:05 PM
kall's Avatar
kall kall is offline
 
Join Date: Apr 2004
Location: New Zealand
Posts: 2,608
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ram94401 View Post
For Like URL, you dont need to optimize it for SEs. If you want to do it, I guess it may not be too difficult. Find the variable for forum name and topic name and format it the way you want it.
That's not true. If vB says one URL, but when Facebook's spider hits it, it sees the vBSEO URL (or vice-versa), the Like will not work.

@soundbarrierpro: There is a thread at vbseo.com that deals with this, just search for Facebook over there.
Reply With Quote
  #118  
Old 08-15-2010, 01:37 AM
paradoxx109 paradoxx109 is offline
 
Join Date: Mar 2007
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi, excellent mod, but I have 2 issues, I have already read every post here but nothing worked.

First: im using FF 3.5.10 and when I hit the like button, the pop up loops between like and unlike and wont stop.

Second: When you use it in IE, it works fine, but when you go to your FB wall the link redirects to a page not found, because is not including the post number.

Im using the IFrame code and vB 3.8.6PL1

Any tips?
Reply With Quote
  #119  
Old 08-15-2010, 06:04 PM
paradoxx109 paradoxx109 is offline
 
Join Date: Mar 2007
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

my second issue above has been already fixed.

Now i wonder, is there any way I can locate the like button just aside the twitter as in this mod

https://vborg.vbsupport.ru/showthread.php?t=248568

Any help will be appreciated.
Reply With Quote
  #120  
Old 08-15-2010, 07:53 PM
hubie hubie is offline
 
Join Date: Jul 2009
Posts: 43
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by paradoxx109 View Post
my second issue above has been already fixed.

Now i wonder, is there any way I can locate the like button just aside the twitter as in this mod

https://vborg.vbsupport.ru/showthread.php?t=248568

Any help will be appreciated.
Post #4 of that thread explains how to locate the like button. Take a look to his code.
Reply With Quote
  #121  
Old 08-15-2010, 08:07 PM
Carlos X Carlos X is offline
 
Join Date: Jun 2007
Location: California
Posts: 57
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have vbSEO installed, so does this work with the facebook like? o_O

And, I'm english spoken, I see another language in your ScreenCaps.
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 02:22 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.11364 seconds
  • Memory Usage 2,363KB
  • 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
  • (7)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
  • (3)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (6)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
  • 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