MyBB Community Forums

Full Version: Facebook 'Like' Button for EVERY Post within a thread.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I have been trying to implement a like button for each post in a thread in my forum for the last few hours.

But I just cannot get it to work!

The thing is, whenever I try to like single post, it just randomly likes some of the other posts, too. COMPLETELY RANDOM! I've checked pid, tid. even uid for anything which might be causing trouble.

It's just unexplainable for me.


I've been trying the following url methods for liking posts:
-domain.com/showthread.php?tid={$tid}?pid={$post['pid']}
-domain.com/showthread.php?tid={$tid}?pid={$post['pid']}#pid{$post['pid']}
-domain.com/showthread.php?pid={$post['pid']}
-domain.com/showthread.php?pid={$post['pid']}?tid={$tid}
-domain.com/showthread.php?pid={$pid}?tid={$tid}
-domain.com/showthread.php?pid=?tid={$tid}#pid{$post['pid']}
-domain.com/showthread.php?pid={$post['pid']}?tid={$post['tid']}
-domain.com/post-{$pid}.html
-domain.com/post-{$post['pid']}.html
-domain.com/{$post['postlink']}
-domain.com/{$post['postlink']}#pid{$post['pid']}


Full like button:
<fb:like layout="box_count" show_faces="false" href="http://www.domain.com/{$post['postlink']}" style="vertical-align: middle;" width="100"></fb:like>

I've also tried facebook's html5, xfbml and iframe versions of the like button.

Whatever I try, the bug stated above is always appearing.


Example:

I like post number 8 in thread xyz.
Then I refresh the page and post number 3 also got a like (by me), but I didnt like it.



Maybe there is a way to use a "showpost.php"? Does anybody know how to create one? Smile



Does anyone else here have a clue maybe? I'm desperate.
Redacted.
I just tried quickly and this works for me

<fb:like layout="box_count" show_faces="false" href="http://www.nintendolounge.com/showthread.php?tid={$thread['tid']}&pid={$post['pid']}#pid{$post['pid']}" style="vertical-align: middle;" width="100"></fb:like>

Obviously replace my domain with yours.
I did and it does not work for me. I still get random likes.
Where did you put the button?

Might try it with the default theme tomorrow..
I put it in my postbit_classic template next to the quote/reply buttons.
How are you going to define the og tags for each post?
(2012-07-28, 12:58 AM)NJunkies Wrote: [ -> ]I put it in my postbit_classic template next to the quote/reply buttons.

So did I, I have also done it in the default mybb theme, no luck.

Did you check for other posts in that thread to see if any of them was also liked?

(2012-07-28, 03:50 AM)brad-t Wrote: [ -> ]How are you going to define the og tags for each post?

You tell me Wink
(2012-07-28, 08:01 AM)king_og Wrote: [ -> ]
(2012-07-28, 12:58 AM)NJunkies Wrote: [ -> ]I put it in my postbit_classic template next to the quote/reply buttons.

So did I, I have also done it in the default mybb theme, no luck.

Did you check for other posts in that thread to see if any of them was also liked?

I just put it back again to test once more, and yep, it just likes the one post for me (or however many I click).

Here's a link if you want to try it (it's on the bottom left of the postbit this time) - http://www.nintendolounge.com/showthread.php?tid=24
Yes, it seems to work fine on your site.
Hmm.. A conflicting plugin might be possible on my end.

Maybe it is Google SEO or some of my htaccess configs.
(2012-07-28, 08:01 AM)king_og Wrote: [ -> ]You tell me Wink

It's not possible, unless each element has a clickthrough link to bring it to its own dedicated page -- something MyBB does not have.

http://stackoverflow.com/questions/43779...-on-a-page