![]() |
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]&layout=button_count&show_faces=true&width=&action=like&colorscheme=light" - 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]&show_faces=false& Installation: Go to your Postbit/Postbit Legacy template and search for: Code:
<!-- controls --> 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> 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))"> 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: |
very cool
thank u installed |
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?
|
Quote:
|
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&show_faces=true& 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 |
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? |
|
Quote:
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 ;) |
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"/> |
This is exactly how it is coded in the example thread I included above:
PHP Code:
|
Quote:
|
you should have a version with thread id only, for those who want it just for thr first post
showthread.php?t=xxxxxx |
The first post option doesn't work. "Like" buttons show on every first page, not first post.
Edit: it shows on private messages too. |
When I put this code in, replacing what I had:
PHP Code:
|
Quote:
|
There is something wrong with the code itself. If I simply put this code:
PHP Code:
|
Here is my whole template. I have tried a couple different versions of this. The code in isolation in a browser window works, but in my template below (which I've tried a couple of different versions), it does not:
PHP Code:
|
Ok, I've gotten it to work with the following code:
PHP Code:
|
in your profile.
|
Quote:
|
I've marked as installed. But with as many things as I've checked as liked, I don't see anything on my wall. Any idea what gives?
|
Quote:
Quote:
Quote:
Replace: Code:
<if condition="!$GLOBALS['FIRSTPOSTID']"> Code:
<if condition="$post[postcount] == 1"> |
Close but no cigar. I found all my recent likes on my FB profile page. But if I click on any of them in FB I get a blank page. It trys to take me to a garbage URL:
PHP Code:
|
wacnstac, i've checked your site and it's working correctly.
The only thing you have to add now is the conditional: Code:
<if condition="$post[postcount] % $vboptions[maxposts] == 1">Your Code</if> |
So why don't the URLS on my fb profile page click through to a valid page. That's the most important part!
|
Also need the ability to exclude private forums.
|
Quote:
Code:
<if condition="$post[postcount] == 1 AND in_array($GLOBALS[forumid], array(X,Y,Z))">Your Code</if> |
Thanks, and PM's should be excluded.
|
This is very cool, but it doesn't seem to work with "Chief 1st post"..?
Any ideas.? Also how does it work..!? Any way that i can "like" things from my FB group or company page, instead of my personal profile.? |
THe demo page returns: error.
|
Quote:
|
Very cool mod, thanks so much
it works exactly how it should :) I'm going to play with the placement a little, but here is a "Like" demo if you want to check it out. |
Looks like a missing closing quote for src tag.
original Code:
<iframe src="http://www.facebook.com/widgets/like.php?href=http://www.YOURSITE.com/showthread.php$session[sessionurl]?p=$post[postid]&show_faces=false& closing quote added Code:
<iframe src="http://www.facebook.com/widgets/like.php?href=http://www.YOURSITE.com/showthread.php$session[sessionurl]?p=$post[postid]&show_faces=false&" |
The button on every single post lags out my website in certain browsers/platforms. Had to take it down =/
|
Quote:
Quote:
Quote:
Quote:
|
I'm going to add this to my site, just had a question on the demo.
I'm looking at it right now, and it only says 1 for the count (was 0 before I clicked it), is that right? After so many from here trying it out, I would think it would be higher than that |
Quote:
|
Quote:
PHP Code:
|
Quote:
I'm assuming that you clicked it too right? I think I'm seeing the same thing on my forum, but I'm waiting for members to reply back if they clicked it in the test post. I think it's a problem on Facebooks side, I've tried adding the like button to my RPG game. So far I only have 1 click there too, even though some have said they clicked it. It also doesn't help that the facebook developer forums have been down all weekend too. |
Has anyone else had any luck with the like button?
It seems for me, at least when I look at it. It only shows when I click on it, and doesn't give a total count of how many have clicked it. Just like the demo, it only shows that I clicked on it and nobody else. That can't be right can it? |
All times are GMT. The time now is 01:55 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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|