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
  #192  
Old 06-15-2011, 08:25 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by mikelangelo2005 View Post
I have a problem with this mod that is not how to fix yet, read the 13 pages of answers that are here and not find a solution.

I have installed the version XFBML. But the problem button "like" is that sometimes appears and sometimes doesn?t appear, not even reloading the page immediately appears.

Any solution?

www.motofanaticos.com

My code
Code:
<if condition="THIS_SCRIPT =='showthread'"> 
<div id="fb-root"></div> <script> 
window.fbAsyncInit = function() {
FB.init({
appId : '103900849703235',
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/es_LA/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
</script> <fb:like layout="standard" show_faces="true" width="338" action="like" colorscheme="light" />
</if>
<br>
Facebook will give you updated code if you get it directly from their website:
http://developers.facebook.com/docs/.../plugins/like/

Quote:
Originally Posted by 4Play View Post
will this mod work for vB 4?
VB4 has a Facebook Like button built in, it just needs to be enabled.
Reply With Quote
  #193  
Old 06-16-2011, 04:59 PM
mikelangelo2005's Avatar
mikelangelo2005 mikelangelo2005 is offline
 
Join Date: Mar 2008
Posts: 14
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by BirdOPrey5 View Post
Facebook will give you updated code if you get it directly from their website:
http://developers.facebook.com/docs/.../plugins/like/



VB4 has a Facebook Like button built in, it just needs to be enabled.

BirdOPrey5:

I made a new "like" on the web you publish, but publish the new code I have another problem. If I click "like" on a thread, then it appears in all forums as if it had been here

The same thing happens with the first 2 codes are posted here.

regards
Reply With Quote
  #194  
Old 06-16-2011, 05:37 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

In the code they give you, you need to change the URL... Replace the hard coded URL with this code:

Code:
$vboptions[bburl]/showthread.php?t=$thread[threadid]
Reply With Quote
  #195  
Old 06-17-2011, 12:56 AM
mikelangelo2005's Avatar
mikelangelo2005 mikelangelo2005 is offline
 
Join Date: Mar 2008
Posts: 14
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by BirdOPrey5 View Post
In the code they give you, you need to change the URL... Replace the hard coded URL with this code:

Code:
$vboptions[bburl]/showthread.php?t=$thread[threadid]
BirdOPrey5

I'm more confused than before! LOL

This is the code that developers give me in "LIKE". http://developers.facebook.com/docs/.../plugins/like/

Where would include the code you give me?

IFRAME
Code:
 
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fmotofanaticos.com%2Fupload&amp;send=false&amp;layout=standard&amp;width=338&amp;show_faces=true&amp;action=like&amp;colorscheme=light&amp;font&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:338px; height:80px;" allowTransparency="true"></iframe>

XFBML
Code:
 
<div id="fb-root"></div><script src="http://connect.facebook.net/en_US/al...cript><fb:like href="http://motofanaticos.com/upload" send="false" width="338" show_faces="true" font=""></fb:like>
Thanks for your help!
Reply With Quote
  #196  
Old 06-17-2011, 02:22 AM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You should use the XFBML code like this:

Code:
<div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like href="$vboptions[bburl]/showthread.php?t=$thread[threadid]" send="false" width="338" show_faces="true" font=""></fb:like>
Reply With Quote
  #197  
Old 06-17-2011, 07:08 AM
mikelangelo2005's Avatar
mikelangelo2005 mikelangelo2005 is offline
 
Join Date: Mar 2008
Posts: 14
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you very much BirdOPrey5,

The code works fine. I tried it on INTERNET EXPLORER, FIREFOX & GOOGLE CHROME and works perfect on all three browsers, also published the titles in the wall?s facebook as published in the threads.

My code
Code:
 
<if condition="THIS_SCRIPT =='showthread'">
<div id="fb-root"></div><script src="http://connect.facebook.net/es_LA/all.js#xfbml=1"></script><fb:like href="$vboptions[bburl]/showthread.php?t=$thread[threadid]" send="false" width="338" show_faces="true" font=""></fb:like> 
</if>

I changed en_US by es_LA for Spanish and additions to the first <if condition="THIS_SCRIPT =='showthread'"> and then at the end </if> to publish "LIKE" in all threads but not in private messages.

regards
Reply With Quote
  #198  
Old 07-14-2011, 05:47 PM
dpnow dpnow is offline
 
Join Date: Jul 2006
Location: Hemel Hempstead UK
Posts: 41
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm finding that the 'like' appears briefly and then disappears. Can anyone help?

Ian
Reply With Quote
  #199  
Old 07-22-2011, 06:38 AM
suko22 suko22 is offline
 
Join Date: Jan 2009
Posts: 38
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by dpnow View Post
I'm finding that the 'like' appears briefly and then disappears. Can anyone help?

Ian
use mikelangelo2005 code, I had same problem and it worked for me
Reply With Quote
  #200  
Old 10-12-2011, 11:19 PM
G37Sam G37Sam is offline
 
Join Date: Jun 2010
Posts: 43
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've even got it to work on vb4.0, added the code in the SHOWTHREAD template though so it appears once on every thread rather than on every post

Thanks for the code
Reply With Quote
  #201  
Old 11-07-2011, 04:46 PM
amine13420 amine13420 is offline
 
Join Date: Nov 2011
Posts: 58
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

How can i put the button in the same line, but in the left it will be better, because here it's behind the quote, thank's button.
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 04:41 AM.


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.07629 seconds
  • Memory Usage 2,372KB
  • 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
  • (12)bbcode_code
  • (5)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
  • (3)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