MyBB Community Forums

Full Version: Adding post ID in code for FaceBook like
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I have Facebook displayed in members posts (take a look).

This is the URL code I'm using below, which does work, but when I try to add the Post ID number to it, so the link in Facebook will jump straight to that post. Things get messed-up. I've tried all sorts of different ways and could do with some ideas now?

This is the URL code I use:

http://www.facebook.com/plugins/like.php?href={$mybb->settings['bburl']}/thread-{$tid}-post-{$post['pid']}.html
To make it jump to the post you'd need to add #pid{$post['pid']} to the end of the URL.
I tried that, there is a problem because of the "#" added in it. Facebook doesn't seem to like it. So I searched out the HTML code to add instead of the "#", but still didn't work.
I don't think it'll be able to jump then unless it has that in it.
No it won't jump directly to the post without it added, that's why I'm asking about doing it. The code I use will jump to the correct page however, just not directly to the post in question without that Post ID number added. But I've already tried this URL below, complete with the bit you suggested added at the end.

http://www.facebook.com/plugins/like.php?href={$mybb->settings['bburl']}/thread-{$tid}-post-{$post['pid']}.html#pid{$post['pid']}

In theory that is right, it should work perfect. But FaceBook doesn't like that "#" in the code it seems to me. I tried searching for the HTML to replace it, I found it and added this below instead of the: #.

#

But just messes up things again.

That's what I'm saying, if it won't allow the # or the HTML entity version of it in there, then you can't make it jump, I don't believe there's any other way of doing it.
Looks like it's not possible then.
That's because you are adding ; at the end of the pid.

You should've to add this;
#pid{$post['pid']}
I wasn't adding a ";" at the end, not sure why you think I was?

Anyway, since posting this I have removed the Facebook Like code now from my forum. I also spotted it was very slow loading in posts, something I wasn't really happy about. I decided to see if I could get it all working with Twitter instead, and I did which you can - read about it here.

I think Twitter is probably the better of the two anyway to be honest.
Because there you've added Undecided

(2010-12-29, 11:36 PM)Gary Bolton Wrote: [ -> ]
#

Pages: 1 2