Back to vBulletin 3.8 Add-ons

Add Facebook "Like" button to your threads [vB 3.8.x]
Mod Version: 1.00, by hubie

vB Version: 3.8.x Rating: (24 votes - 4.67 average) Installs: 225
Released: 23 Apr 2010 Last Update: Never Downloads: 1332
Not Supported Template Edits  

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.

http://www.htceros.com/noticias/371-comparacion-de-browsers-htc-desire-vs-htc-hd2-vs-iphone.html

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 )

You'll need to register your app here: https://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:

Spoiler (click to open)


Here's a fix of IE issue changing some code. With this code the button is now displayed in IE browser.

Please let me know if it's working properly.

Code:
<div id="fb-root"></div> <script> 
  window.fbAsyncInit = function() {
    FB.init({
      appId  : '100673979977717',
      status : true, // check login status
      cookie : true, // enable cookies to allow the server to access the session
      xfbml  : true  // parse XFBML
    });
  };
  (function() {
    var e = document.createElement('script');
    e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
    e.async = true;
    document.getElementById('fb-root').appendChild(e);
  }());
</script> <fb:like layout="standard" show_faces="true" width="300" action="like" colorscheme="light" />
*Note: If you use the appId that appears in the code above, you'll get an interesting effect 'onmouseover' with the title of thread.

Close


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

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

Remember to click Mark as Installed if you use this modification

Download

File Type: %1$s Facebook Like Button.txt (1.3 KB, 1382 downloads)

Screenshots

Click image for larger version
Name:	faceb1.jpg
Views:	4748
Size:	41.1 KB
ID:	116200   Click image for larger version
Name:	faceb2.jpg
Views:	2587
Size:	6.9 KB
ID:	116201   Click image for larger version
Name:	faceb3.jpg
Views:	3092
Size:	32.8 KB
ID:	116202   Click image for larger version
Name:	fbk1.jpg
Views:	3413
Size:	17.4 KB
ID:	116518  

Click image for larger version
Name:	fbk2.jpg
Views:	2584
Size:	28.4 KB
ID:	116519  

Similar Mods

Show Thread Enhancements Add New Facebook "Like" button to your threads vBulletin 4.x Template Modifications

vblts.ru supports vBulletin®, 2022-2024