vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.8 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=235)
-   -   Add-On Releases - Add Facebook "Like" button to your threads [vB 3.8.x] (https://vborg.vbsupport.ru/showthread.php?t=241053)

hubie 04-22-2010 10:00 PM

Add Facebook "Like" button to your threads [vB 3.8.x]
 
1 Attachment(s)
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.

https://vborg.vbsupport.ru/external/2011/10/45.png

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:

kimof911 04-23-2010 11:36 AM

very cool

thank u

installed

wacnstac 04-23-2010 02:54 PM

Two comments. After I install and customize to my URL it clicks my like through momentarily and indicates that my User Name likes the post, but then it quickly transistions to showing "Be the first of your friends to like this. · Admin Page · Error" Also my likes never get posted on my facebook wall. How do I get it to show on my wall?

hubie 04-23-2010 03:22 PM

Quote:

Originally Posted by wacnstac (Post 2026006)
Two comments. After I install and customize to my URL it clicks my like through momentarily and indicates that my User Name likes the post, but then it quickly transistions to showing "Be the first of your friends to like this. ? Admin Page ? Error" Also my likes never get posted on my facebook wall. How do I get it to show on my wall?

Have you tried the two versions of button? Please send me a link to check.

wacnstac 04-23-2010 03:27 PM

Looking at my source for the page in question gives me some answers. The source generated shows:

<iframe src="http://www.facebook.com/widgets/like.php?href=http://www.michigan-sportsman.com/showthread.php?p=3110497&amp;show_faces=true&amp
scrolling="no" frameborder="0"


but the real URL for the page is: http://www.michigan-sportsman.com/fo...d.php?t=327362

You can see a demo of the problem I am seeing if you go here:
http://www.facebook.com/widgets/like....php?p=3110497

wacnstac 04-23-2010 03:32 PM

Actually once I added "forum" in my path so that I have the correct URL, it does work in isolation:

http://www.facebook.com/widgets/like...ling=%22yes%22

But still throws an error when on my forum. Any ideas?

wacnstac 04-23-2010 03:33 PM

Here's a link to where it is deployed:

http://www.michigan-sportsman.com/fo...d.php?t=327362

hubie 04-23-2010 03:39 PM

Quote:

Originally Posted by wacnstac (Post 2026026)
Looking at my source for the page in question gives me some answers. The source generated shows:

<iframe src="http://www.facebook.com/widgets/like.php?href=http://www.michigan-sportsman.com/showthread.php?p=3110497&amp;show_faces=true&amp
scrolling="no" frameborder="0"


but the real URL for the page is: http://www.michigan-sportsman.com/fo...d.php?t=327362

You can see a demo of the problem I am seeing if you go here:
http://www.facebook.com/widgets/like....php?p=3110497

You have to change "showthread.php?p=3110497" for "showthread.php$session[sessionurl]?p=$post[postid]".

You only have to put your sitename, then you code would be: "http://www.michigan-sportsman.com/forum/showthread.php$session[sessionurl]?p=$post[postid]..."

If it helps you mark as installed, if not, comment please ;)

Yellow Slider 04-23-2010 03:40 PM

why aren't you using the the meta data in the showthread page?

* <meta property="og:title" content="The Rock"/>
* <meta property="og:site_name" content="IMDb"/>
* <meta property="og:image" content="http://ia.media-imdb.com/rock.jpg"/>

wacnstac 04-23-2010 03:47 PM

This is exactly how it is coded in the example thread I included above:

PHP Code:

<iframe src="http://www.facebook.com/widgets/like.php?href=http://www.michigan-sportsman.com/forum/showthread.php$session[sessionurl]?p=$post[postid]&amp;show_faces=true&amp
        scrolling="
no" frameborder="0
        style="
border:nonewidth:450pxheight:80px"></iframe> 



All times are GMT. The time now is 05:16 AM.

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.02131 seconds
  • Memory Usage 1,758KB
  • 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
  • (5)bbcode_code_printable
  • (1)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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