PDA

View Full Version : Embed a facebook post into vbulletin?


DannyITR
10-09-2015, 01:13 PM
I searched but is there any way to embed a Facebook POST rather than just a video?

I tried fooling around with making a custom bb code with fb embed code but didn't' get very far.

Dave
10-09-2015, 02:56 PM
https://developers.facebook.com/docs/plugins/embedded-posts

<script src="//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.2" async></script>
<div class="fb-post" data-href="https://www.facebook.com/FacebookDevelopers/posts/10152128760693553" data-width="500"></div>

That should do the trick, then the replacement variable should be the data-href URL.

DannyITR
10-09-2015, 03:08 PM
Since each post has the page's or person's name in it (in addition to the post number), I don't think it'll work as it does for videos.

Dave
10-09-2015, 03:19 PM
It should work fine as long as they use the right URL to the post.

DannyITR
10-09-2015, 04:06 PM
It should work fine as long as they use the right URL to the post.

The embedding works but because the fb developers page address is hard coded into the bb code, no matter what post I put, it's alwasy the same one.

<script src="//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.2" async></script>
<div class="fb-post" data-href="https://www.facebook.com/FacebookDevelopers/posts/10152128760693553" data-width="500"></div>

Dave
10-09-2015, 04:16 PM
You probably misunderstood me, people have to provide the whole URL in the bbcode for that, not just the ID.

<div class="fb-post" data-href="FULL_URL_TO_POST_BY_USER_HERE" data-width="500"></div>

Alan_SP
04-28-2016, 08:00 PM
It doesn't work for me. For some people, it does, but not for all. If you know the reason why it doesn't work, it would be great.

And, interesting is, when I look at BBcode in BBcode manager, it works in small window next to each BBcode (Replacement video), but it doesn't show in posts. Like some crucial info is stripped from that area.

EDIT:

Inspecting element, this is what I see:

<div class="fb-post" data-href="https://www.facebook.com/slobodni.net/posts/992355867520543" data-width="500"></div>

Don't know from where this [autolink] comes. It obviously makes problem.

Dave
04-28-2016, 08:47 PM
Maybe AUTOLINK is coming from another plugin?

Alan_SP
04-29-2016, 05:35 PM
You're right, it does. VaultWiki. You spotted it right. I'll try again with different post and video content.

EDIT: I managed to get working facebook video and post, except some (so far I see that they have permalink in their link).

Other problem is that I need to reload page to see them (full reload).

EDIT2: About last problem, it is caused by AJAX. Posts that go through AJAX don't show facebook content.

TheLastSuperman
05-02-2016, 06:49 PM
I thought that not too long ago the iframe version of this was deprecated yet I still see the Javascipt and iframe versions available here:
https://developers.facebook.com/docs/plugins/page-plugin

Just make sure you're using the most current version of the code or any code from facebook, keep it up to date as well including any apps in your facebook developers account.

It looks like Dave is right, seems to be another plugin inserting this into url.

Alan_SP
05-02-2016, 07:02 PM
At the moment I have working posts (for most post, those that have groups and permalink in their url don't work for some reason, there's error message) and videos.

Beergeeksf
03-21-2020, 05:47 PM
Got this working -- mostly:

Replacement code:

<script src="//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.2" async></script>
<div class="fb-post" data-href="{param}" data-width="500"></div>


But note that Facebook has been adding whole bunch of tracking parameters to the URL, so for the embed to work, the URL will need to be trimmed of any parameters -- ?and after.

So this URL:

https://www.facebook.com/ProBrewerPage/posts/10158584785235864?__xts__%5B0%5D=68.ARCJaHKimtZSFQ hySsK6EPa27irQJVNYV3jHBc0OH7-os29u2HNFcgjkg2RFaElp2R08wEg3tGWOLU898FiFwZZ_1woIe XShO-jpdaUd6VG9xsBgYOINFxDC6eWd9SpZxPEYURA5Cd6cknGIUlAV z2ahFampJBpLGZS_YQ8X5zQF2qf1F-VvQIem82bFQSOM-4oKK0Ii5nUcz8mbtGravlkCOyiiYbdqRbBNJ__bY3mQ6S1jPMi 9XnSiL8_jdd7VVMM5QCk-eLLoev46hUi4K0NjjsQd7lKKIYQPG7FbSTY4CobmRhzlrKuZvC dud8FYG42ATqLkR7200KZIXUho&__tn__=-R

Needs to become this URL for the embed to work properly:

https://www.facebook.com/ProBrewerPage/posts/10158584785235864