Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: dougiefresh on July 11, 2015, 02:33:41 PM

Title: Embed Facebook BBCode
Post by: dougiefresh on July 11, 2015, 02:33:41 PM
Link to Mod (https://custom.simplemachines.org/mods/index.php?mod=4062)



EMBED FACEBOOK BBCODE v3.12
By Dougiefresh (http://www.simplemachines.org/community/index.php?action=profile;u=253913) -> Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=4062)



Introduction
This modification adds a BBCode to embed Facebook posts and videos into your forum.  Embedding posts and videos are simple way to put public posts and videos - by a Page or a person on Facebook - into the content of your web site or web page.  Only public posts from Facebook Pages and profiles can be embedded.

The BBCode takes these forms:

[facebook]{facebook URL}[/facebook]
[facebook width={x}]{facebook URL}[/facebook]

where {facebook URL} is the URL to the facebook photo post, post or video that you want to display and {x} is the width of the post desired.  Note that if the width isn't specified, the global setting will be applied.

User Profile Settings
Under Profile => Look and Layout, there is a new option called Language the Facebook controls are shown in.  It's purpose is set the language of the Facebook controls used in each post that the user can see, which is overridden by Facebook when the user is already logged in.  Please note that setting this option only controls the default language of the FB controls, not the posts themselves, and does NOT translate the posts into a different language!

Admin Settings
Under Admin => Modification Settings, there are some new options:
o Language the Facebook controls are shown in.  It's purpose is to define the forum's default language for the Facebook post, which is overridden by Facebook when the user is already logged in.  Please note that setting this option only controls the default language of the FB controls, not the posts themselves, and does NOT translate the posts into a different language!
o Default width of embedded Facebook video
o Default height of embedded Facebook video
o Include Facebook link beneath?

Further Information
o Facebook Embedded Posts (https://developers.facebook.com/docs/plugins/embedded-posts), specifically Getting a posts's URL

Compatibility Notes
This mod was tested on SMF 2.0.10, but should work on SMF 2.1 RC2, as well as SMF 2.0 and up.  SMF 1.x and SMF 2.1 Beta 1 is not and will not be supported.

Changelog
The changelog can be viewed at XPtsp.com (http://www.xptsp.com/board/free-modifications/embed-facebook-bbcode/).

License
Copyright (c) 2015 - 2019, Douglas Orend
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Title: Re: Embed Facebook BBCode
Post by: Apllicmz on July 12, 2015, 02:17:39 AM
nice Work
Good Mod
When try puty portuguese see that error
attach
Title: Re: Embed Facebook BBCode
Post by: Apllicmz on July 12, 2015, 02:27:28 AM
Yes now iam Done

i change

<search position="before">

to

[code]<search position="end">
Title: Re: Embed Facebook BBCode
Post by: villasg on July 12, 2015, 02:54:27 AM
Nice

Grekk-uft8
<file name="$languagedir/ManageSettings.greek-utf8.php">
<operation>
<search position="before"><![CDATA[$txt['languages_ltr'] = 'Δεξιά προς αριστερά';]]></search>
<add><![CDATA[$txt['fb_default_lang'] = 'Προεπιλογή γλώσσας Facebook:';]]></add>
</operation>
</file>



Problem .
I install without errors .
In Admin => Modification Settings showing and can change .
No any errors when try to post
But .
Do not show the bbc image for facebook ( checking exists in directory) and have lost bbc image from 2 another mods from you "Embed Instagram BBCode (http://custom.simplemachines.org/mods/index.php?mod=4059)" and from Yet Another YouTube BBCode Tag
(http://custom.simplemachines.org/mods/index.php?mod=3982)

(http://s14.postimg.org/xuk7trhi9/Snap3.jpg)
(http://s11.postimg.org/4fcfc6x2b/Snap1.jpg)

Very strange

(http://i.imgur.com/6uk3AFc.png)

Remove mod but Instagram BBCode not showing ....



After remove this mod , remove instagram &  YouTube  mod and install again  but nothing happened .
"Embed Instagram BBCode" @ Yet Another YouTube BBCode Tag do not showing lost it ...... >:(

Finaly do not have anymore working "Embed Instagram BBCode" @ "Yet Another YouTube BBCode Tag" in my forum and can not make it work ..................

Title: Re: Embed Facebook BBCode
Post by: villasg on July 12, 2015, 03:23:11 AM
After remove this mod , remove instagram mod and install again instagram  but nothing happened .
"Embed Instagram BBCode" do not showing lost it ...... >:(
Title: Re: Embed Facebook BBCode
Post by: villasg on July 12, 2015, 07:22:55 AM
Update :
After checking bbc tags works [instagram]xxxxxxxxx[/instagram]

[youtube]xxxxxxxxxx[/youtube]

[facebook]xxxxxxxxxxxxx[/facebook]


but bbc images in post do not showing .

(http://i.imgur.com/x3q9EN2.png)

How cai n fix it this ?
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on July 12, 2015, 07:44:50 AM
Quote from: Joomlamz on July 12, 2015, 02:17:39 AM
nice Work
Good Mod
When try puty portuguese see that error
attach
Quote from: Joomlamz on July 12, 2015, 02:27:28 AM
Yes now iam Done

i change<search position="before">

to

[code]<search position="end">

Um... This mod doesn't contain a Portuguese language file.  Do you want to share a translation with everybody else?  If so, please attach your language files and I'll include them in the next version!

Quote from: villasg on July 12, 2015, 02:54:27 AM
Nice

Grekk-uft8
<file name="$languagedir/ManageSettings.greek-utf8.php">
<operation>
<search position="before"><![CDATA[$txt['languages_ltr'] = 'Δεξιά προς αριστερά';]]></search>
<add><![CDATA[$txt['fb_default_lang'] = 'Προεπιλογή γλώσσας Facebook:';]]></add>
</operation>
</file>

I'll include it in the next version!

Quote from: villasg on July 12, 2015, 02:54:27 AM
Problem .
I install without errors .
In Admin => Modification Settings showing and can change .
No any errors when try to post
But .
Do not show the bbc image for facebook ( checking exists in directory) and have lost bbc image from 2 another mods from you "Embed Instagram BBCode (http://custom.simplemachines.org/mods/index.php?mod=4059)" and from Yet Another YouTube BBCode Tag
(http://custom.simplemachines.org/mods/index.php?mod=3982)

(http://s14.postimg.org/xuk7trhi9/Snap3.jpg)
(http://s11.postimg.org/4fcfc6x2b/Snap1.jpg)

Very strange

(http://i.imgur.com/6uk3AFc.png)

Remove mod but Instagram BBCode not showing ....



After remove this mod , remove instagram &  YouTube  mod and install again  but nothing happened .
"Embed Instagram BBCode" @ Yet Another YouTube BBCode Tag do not showing lost it ...... >:(

Finaly do not have anymore working "Embed Instagram BBCode" @ "Yet Another YouTube BBCode Tag" in my forum and can not make it work ..................
Let me look into this....  Meanwhile, can you verify that you have the Subs-BBCode-Instagram.php and Subs-BBCode-YouTube.php files in your Sources folder?
Title: Re: Embed Facebook BBCode
Post by: villasg on July 12, 2015, 09:15:02 AM
Quote from: dougiefresh on July 12, 2015, 07:44:50 AM
Let me look into this....  Meanwhile, can you verify that you have the Subs-BBCode-Instagram.php and Subs-BBCode-YouTube.php files in your Sources folder?

verified

(http://i.imgur.com/MRJu7CZ.png)

And

(http://i.imgur.com/hofRvbR.png)
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on July 12, 2015, 11:18:57 AM
Can you verify that under the "integrate_pre_include" hooks that they are loaded?
Title: Re: Embed Facebook BBCode
Post by: villasg on July 12, 2015, 12:06:39 PM
Quote from: dougiefresh on July 12, 2015, 11:18:57 AM
Can you verify that under the "integrate_pre_include" hooks that they are loaded?

(http://i.imgur.com/ryz7H4K.png)


I install anothet bbc mod ( "BBCode Colorbox (http://custom.simplemachines.org/mods/index.php?mod=4055)" ) for testing and showing great the bbc button

(http://i.imgur.com/9MApLp6.png)
Title: Re: Embed Facebook BBCode
Post by: villasg on July 12, 2015, 01:05:32 PM
I install anothet bbc mod ( "BBCode Colorbox (http://custom.simplemachines.org/mods/index.php?mod=4055)" ) for testing and showing great the bbc button

(http://i.imgur.com/9MApLp6.png)
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on July 12, 2015, 01:59:25 PM
Well, I just got installed every mod that the file listing showed (I have to note they were all mine  :P ), and checked the editor.  All the buttons are there, so I am at a complete loss as to why some of the bbcodes aren't working and the buttons aren't showing up....  Attached is a pic of the buttons from my clean forum....
Title: Re: Embed Facebook BBCode
Post by: villasg on July 12, 2015, 02:04:29 PM
I am confused , i do not know what happened ....
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on July 12, 2015, 02:17:43 PM
Me neither....  Is there any chance that the bbcodes are disabled in the Admin area (Forum => Posts and Topics => Bulletin Board Code)?
Title: Re: Embed Facebook BBCode
Post by: villasg on July 12, 2015, 02:29:00 PM
Quote from: dougiefresh on July 12, 2015, 02:17:43 PM
Me neither....  Is there any chance that the bbcodes are disabled in the Admin area (Forum => Posts and Topics => Bulletin Board Code)?

If disabled all not showing if disable only the facebook - yet - instagram are the same results do not showing anything
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on July 13, 2015, 11:53:25 AM
I installed the mods indicated by the file list you gave (probably incomplete, but...) and all the mods play together nicely for me.  I don't know what to tell ya....
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on August 08, 2015, 10:10:21 AM
Uploaded v1.1 - August 8th, 2015
o Added Greek UTF8 language string modification to the mod.
o Added additional validation to make sure the bbcode isn't abused.
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on August 14, 2015, 07:30:36 PM
Uploaded v2.0 - August 14th, 2015
o Added user setting under Profile => Look and Layout to override global forum setting.
o BBCode "lang" parameter is now completely ignored, as user and forum settings are now used instead.
o Facebook script inclusion moved from post area to HTML head area.
o Removed Greek UTF8 language modification, citing new string better describing the purpose.




@villasg: Can you make a copy of the language_english.xml file and translate the new string within?  I need you to ATTACH the new file to the post, not insert the contents of the file into a post!!!  Thanks!
Title: Re: Embed Facebook BBCode
Post by: villasg on August 15, 2015, 03:36:15 AM
Quote from: dougiefresh on August 14, 2015, 07:30:36 PM

@villasg: Can you make a copy of the language_english.xml file and translate the new string within?  I need you to ATTACH the new file to the post, not insert the contents of the file into a post!!!  Thanks!

done
Title: Re: Embed Facebook BBCode
Post by: villasg on August 15, 2015, 06:32:42 AM
Work great with the tags [facebook]...................[/facebook]  , settings works  , but i still have the problem with your mods ( not showing the bbc button/image) ........
Title: Re: Embed Facebook BBCode
Post by: villasg on August 16, 2015, 03:28:04 AM
Today  i try many links from facebook and do not work ........
Can not make it to work .
What is my fault ?

links like

https://www.facebook.com/garlic.salon/videos/536857533086933
https://www.facebook.com/495741830461710/videos/874658245903398
https://www.facebook.com/marcia.lopes.9026040/videos/1103271836367499
https://www.facebook.com/OlympiakosEidisis.GR/videos/1673849002834862
https://www.facebook.com/DailyMail/videos/1020218588037889

syntax are : [facebook]https://www.facebook.com/DailyMail/videos/1020218588037889[/facebook]
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on August 16, 2015, 07:31:13 PM
At this time, this mod doesn't support displaying Facebook videos, only posts....  I'll see what I can do about implementing support for Facebook videos....
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on August 17, 2015, 05:03:09 PM
I've got support for Facebook videos implemented, however I've still got to add another option to control the default width for videos and posts....  Thought I'd let you know....
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on August 17, 2015, 07:56:38 PM
@villasg: I've got two more strings for you to translate in order to properly support the new default width options..  Please translate the English lines, then send it back to me please.  Thank you!
Title: Re: Embed Facebook BBCode
Post by: villasg on August 18, 2015, 08:35:46 AM
Quote from: dougiefresh on August 17, 2015, 07:56:38 PM
@villasg: I've got two more strings for you to translate in order to properly support the new default width options..  Please translate the English lines, then send it back to me please.  Thank you!

done
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on August 18, 2015, 05:17:31 PM
Uploaded v2.1 - August 18th, 2015
o Added support for responsive Facebook videos to the mod.
o Added option to control the default width of the post when it is not specified.
o Added option to control the default width of the video when it is not specified.
o Updated Greek UTF8 language modifications, due to several new strings to support new options.
o Moved text for mod options from "index" to "ManageSettings" language file.




@villasg:  Thank you for the translation!  It's been included in this version!

@Everybody: Facebook videos are now supported by this mod.  They typically take the form:
Quotehttps://www.facebook.com/garlic.salon/videos/536857533086933
where the first text in bold is the user name and the number in bold is the video ID number.   It may also take the form:
Quotehttps://www.facebook.com/video.php?v=536857533086933
I hope this helps those who need this functionality!
Title: Re: Embed Facebook BBCode
Post by: villasg on August 19, 2015, 01:57:47 AM
Be careful .
If you have install EMBED INSTAGRAM BBCODE v1.7 after this mod , receive errors in unistall in post.php .
need to edit the install20x.xlm from   Embed Facebook BBCode V 2.0 package .
Need make this edits : replace "<img>" with "<img><iframe>"

<file name="$sourcedir/Post.php">
<operation>
<search position="replace"><![CDATA['<img>]]></search>
<add><![CDATA['<img><div>]]></add>
</operation>
<operation>
<search position="replace"><![CDATA['<img>]]></search>
<add><![CDATA['<img><div>]]></add>
</operation>
</file>


with

<file name="$sourcedir/Post.php">
<operation>
<search position="replace"><![CDATA['<img><iframe>]]></search>
<add><![CDATA['<img><iframe><div>]]></add>
</operation>
<operation>
<search position="replace"><![CDATA['<img><iframe>]]></search>
<add><![CDATA['<img><iframe><div>]]></add>
</operation>
</file>


@dougiefresh please check it if its corret and safe
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on August 19, 2015, 07:42:03 PM
In this particular case, it seems easier to make the alteration to Sources/Post.php and change the order to match what is expected.  Just search for "<img>" and make it conform to what is expected.  For example, change <img><iframe><div> to <img><div><iframe>....  The order for those two operations doesn't really matter, as the function that uses them omits all HTML tags except for what is shown.

Is it safe to modify the mod?  Well.... I guess....  But I wouldn't advise it.  You risk breaking stuff when you install the next version, especially if you write stuff that my mod never had...  :P   I wrote my assorted video mods to be able to install all of them together.  And YES, I have installed all of them together on a test forum.  They all work.

Furthermore, I really wouldn't advise modifying the mod package without good reason.....  One good reason might be compatibility with another mod.  However, such concerns should be shared with the mod author....

I hope this helps....
Title: Re: Embed Facebook BBCode
Post by: villasg on August 20, 2015, 02:42:11 AM
Understand but my lines with <img> are this :


1534 if ($smcFunc['htmltrim'](strip_tags(parse_bbc($_POST['message'], false), '<img><iframe><iframe><div><div><iframe><div><iframe><div><object><embed><div><iframe>')) === '' && (!allowedTo('admin_forum') || strpos($_POST['message'], '[html]') === false))

2478               if ($smcFunc['htmltrim'](strip_tags(parse_bbc($_POST['message'], false), '<img><object><embed><div><iframe>')) === '')



How can modify this lines ?
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on August 20, 2015, 03:55:43 AM
@villasg: Modifying the lines like this should work to correctly uninstall the mod:
Quote from: villasg on August 20, 2015, 02:42:11 AM

1534 if ($smcFunc['htmltrim'](strip_tags(parse_bbc($_POST['message'], false), '<img><div><iframe><iframe><div><iframe><div><iframe><div><object><embed><div><iframe>')) === '' && (!allowedTo('admin_forum') || strpos($_POST['message'], '[html]') === false))

2478               if ($smcFunc['htmltrim'](strip_tags(parse_bbc($_POST['message'], false), '<img><div><object><embed><iframe>')) === '')

Title: Re: Embed Facebook BBCode
Post by: villasg on August 20, 2015, 04:36:10 AM
Ty
Title: Re: Embed Facebook BBCode
Post by: villasg on August 21, 2015, 07:36:22 AM
Today i see  errors in my forum .
I have this error when i or any member visit the   [ Profile ]  my forum »Profile of *****» Account Settings every visiting i receive error in error log

Look :
http://www.*****/***/forum/index.php?action=profile;area=account
8: Undefined index: facebook_lang
File: /home/thai/public_html/forum/Sources/Subs-BBCode-Facebook.php
Line: 162


If visiting   forum» Profile of ****»Forum Profile
http://www.thai.gr/forum/index.php?action=profile;area=forumprofile;u=11
8: Undefined index: facebook_lang
File: /home/thai/public_html/forum/Sources/Subs-BBCode-Facebook.php
Line: 162


If visiting   forum» Profile of ****»Look and Layout
http://www.thai.gr/forum/index.php?action=profile;area=theme;u=11
8: Undefined index: facebook_lang
File: /home/thai/public_html/forum/Sources/Subs-BBCode-Facebook.php
Line: 162


If visiting   forum» Profile of ****»Personal Messaging
http://www.thai.gr/forum/index.php?action=profile;area=pmprefs;u=11
8: Undefined index: facebook_lang
File: /home/thai/public_html/forum/Sources/Subs-BBCode-Facebook.php
Line: 162



And in my forum »Profile of *****» Account Settings i do not see any Facebook field .
Title: Re: Embed Facebook BBCode
Post by: villasg on August 23, 2015, 08:47:17 AM
Any idea for this errors ?
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on August 23, 2015, 12:02:20 PM
Damn!  I missed this last message.  I'll look into it when I get home today....
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on August 23, 2015, 04:57:45 PM
Uploaded v2.2 - August 23rd, 2015
o Correction of which language file to insert new strings into....




@villasg:  I'm sorry about the lateness of this update.  I had changed which language file got the new strings inserted into, but it was the wrong file....  I've changed the language file back to the proper one, which it was in v2.0.....
Title: Re: Embed Facebook BBCode
Post by: villasg on August 24, 2015, 02:45:26 AM
Quote from: dougiefresh on August 23, 2015, 04:57:45 PM
Uploaded v2.2 - August 23rd, 2015
o Correction of which language file to insert new strings into....

.................

Sorry but have the exact same issue with v2.2 :

(http://i.imgur.com/KstR9qq.png)
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on August 24, 2015, 06:06:14 PM
Uploaded v2.3 - August 24th, 2015
o Fixed stupid language bug that I completely missed in the last 2 versions.... (Sigh)




@villasg:  Whoops!  I should have better tested the mod package before releasing it into the wild....
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on August 25, 2015, 06:46:56 PM
Uploaded v2.4 - August 25th, 2015
o Added ability to auto-embed Facebook URLs to the mod.
Title: Re: Embed Facebook BBCode
Post by: villasg on August 26, 2015, 04:05:39 PM
Tested all OK now thanks
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on August 26, 2015, 04:43:28 PM
Uploaded v2.5 - August 26th, 2015
o Fixed issue with auto-embedding code that created double bbcode tags around Facebook URLs.




@Everybody: This update fixes an auto-embedding issue in v2.4 where using the following:
[facebook]{facebook URL}[/facebook]
resulted in this:
[facebook][facebook]{facebook URL}[/facebook][/facebook]
Title: Re: Embed Facebook BBCode
Post by: villasg on August 26, 2015, 04:48:59 PM
I do not have this issue with  2.4
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on August 26, 2015, 05:10:18 PM
Huh, my test site did.....  Hence the need for the fix....
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on August 29, 2015, 11:37:26 AM
Uploaded v2.6 - August 29th, 2015
o Fixed missing CSS file operations within package-info.xml
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on September 06, 2015, 01:08:07 PM
Uploaded v2.7 - September 6th, 2015
o Fixed issue where BBCodes list was completely empty because of mod... (shrug)
Title: Re: Embed Facebook BBCode
Post by: stefan357965 on September 14, 2015, 11:46:09 AM
Quote from: dougiefresh on September 06, 2015, 01:08:07 PM
Uploaded v2.7 - September 6th, 2015
o Fixed issue where BBCodes list was completely empty because of mod... (shrug)
[/quote

Great work man!
Title: Re: Embed Facebook BBCode
Post by: Koda on September 20, 2015, 10:34:02 PM
Thank you for making this mod dougiefresh!  I have an issue, and I am sure it is mine, but maybe you can assist me.

All facebook posts that have type=1 or an &id tag at the end are not showing up with this mod when I post to my forum.  I can post everything from my wall fine for some reason, but with others the &id is present which prevents me from sharing, even if the post is marked as public.  Any idea?  I am not that well versed in facebook.  Thank you!



Think I figured it out, some profiles are set to private even though the posts are set to public.  This is preventing the posts from being shared even if they appear public.  To get the proper link for public posts, right click the timestamp when it was posted and copy/paste the link.  Posts that have extra text after the proper id are not public posts.

As a recommendation for a future version, maybe include a hover info box over the facebook icon explaining these things to new users.  A dev may be able to figure it out but I doubt even 10% of my members would be able to figure out how to use this feature correctly due to facebooks security settings.
Title: Re: Embed Facebook BBCode
Post by: Koda on September 21, 2015, 03:44:20 AM
Sorry for the double post, but I have been working with your mods for the past few hours and really like them, but there seems to be some issue with the mods and the bbcode.  When I post the links with the code manually entered it sometimes messes up and throws out an extra [/facebook] tag, this also happens if I insert multiple bbcode tags into the same thread, but the formatting really gets messed up and only the first link is displayed, the rest are eaten up and bbcode is displayed instead.  Any input is much appreciated, thank you.
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on September 21, 2015, 11:27:57 AM
Uploaded v2.8 - September 21st, 2015
o Fixed auto-embedding issue where URLs inside code tags where auto-linked.
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on September 21, 2015, 11:31:38 AM
Uploaded v2.8 - September 21st, 2015
o Fixed auto-embedding issue where URLs inside code tags where auto-linked.




@Koda: Let me look into these bug reports.  If you could provide the text of the post for me to test against, it might be very helpful....
Title: Re: Embed Facebook BBCode
Post by: Koda on September 22, 2015, 04:50:54 PM
Anytime I post a facebook link it tries to auto embed including when I use the embed manually.

[facebook]facebook.com/page#goeshere[facebook]f will turn into the facebook post followed by [/facebook] text.  When a link to facebook is posted, a [/facebook] also follows.  Just tested with 2.8 update.

This also happens with your tumblr mod, perhaps it may be specific to my theme or other mods I have installed?

Here is an example with the tumblr mod, it is the same error with the facebook mod:

http://phytoactive.net/herbs/test-104/msg125/#msg125

Thanks!
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on September 22, 2015, 07:51:35 PM
Quote from: Koda on September 22, 2015, 04:50:54 PM
[facebook]facebook.com/page#goeshere[facebook]f
@Koda:  I need actual links to check against.  Giving me something so generic is virtually useless in trying to diagnose this issue....
Title: Re: Embed Facebook BBCode
Post by: Koda on September 27, 2015, 02:07:36 PM
Well the issue is with the bbcode not exactly the display of the facebook code.  I experience the same error with all of your bbc embed mods (facebook, tumblr). 

Example:  posting http://h-e-r-b-s.tumblr.com/post/129892397465 into a post creates http://h-e-r-b-s.tumblr.com/post/129892397465[/tumblr]

If I post [tumblr]http://h-e-r-b-s.tumblr.com/post/129892397465[/tumblr] I will receive the embedded tumblr code, but there is always a visible [/tumblr] after it.  If I post another [tumblr] tag afterwards, the formatting gets really messed up and only the first embedded tumblr is shown, afterwards is broken bbc. 

You can see my test page here: http://phytoactive.net/herbs/test-104/msg125/#msg125

Scroll to the bottom where you can see the bbc start to break.  The issue is the same as facebook, and your other bbc mods with my template.  Other bbc mods do not cause this issue.

Title: Re: Embed Facebook BBCode
Post by: dougiefresh on September 27, 2015, 07:57:54 PM
I had to register on your forum in order to see how you used the bbcodes.  One problem that you have is the mod expects this:
[tumblr]http://h-e-r-b-s.tumblr.com/post/129892397465[/tumblr]
and what you have is this:
[tumblr]http://h-e-r-b-s.tumblr.com/post/129892397465
[/tumblr]

Putting the closing tag on the same line as the rest of it SHOULD fix this.  Since your usage wasn't an expected usage of the bbcode, the auto-embed isn't "equipped" to deal with the issue....

I've fixed this issue for the next version of each of the Facebook, Tumblr and Instagram mods, however, I don't have time tonight to package them up and release them properly since it's my bedtime.  (I get up too early in the morning...  :P) I'll do it tomorrow.
Title: Re: Embed Facebook BBCode
Post by: Koda on September 28, 2015, 02:12:33 AM
Not sure how the formatting would have been changed to that, but I did just try to post 2x tumblr posts and received no errors.  I will install the updated facebook mod tomorrow and let you know if the issue still exists.

It may be entirely with my software, I noticed another mod doing this too when I tried to tag a link with the bbc, it tried to format after the link was already formatted.
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on October 02, 2015, 10:23:27 AM
I've been working multple 12+ hour shifts over the last week and haven't had the energy or time to work on this bug report.  However, today, I've fixed and uploaded the new version of the Tumblr mod.  Later today, I'll fix my Facebook and Instagram mods and upload them.
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on October 02, 2015, 10:51:08 AM
Uploaded v2.9 - October 2nd, 2015
o Rewrote auto-embedding code to deal with line-breaks and duplicate closing brackets.
o Added "Invalid Facebook URL" message for use with invalid FB URLs (duh)....




@Everybody: This update fixes the auto-embed code so that tags and URLs like the following are correctly dealt with:
Code (Line break after URL) Select
[facebook]{link here}
[/facebook]

Code (Line break before URL) Select
[facebook]
{link here}[/facebook]

Code (Line break before and after URL) Select
[facebook]
{link here}
[/facebook]
Title: Re: Embed Facebook BBCode
Post by: Mimmi on October 26, 2015, 07:00:52 AM
Thank you for a nice mod! Here is Norwegian translation:

$txt['fb_default_lang'] = 'Språket Facebook-kontrollene er vist i:';
$txt['fb_default_video_width'] = 'Standard bredde av innebygd Facebook-video:';
$txt['fb_default_post_width'] = 'Standard bredde av innebygd Facebook-innlegg:';
$txt['fb_invalid'] = '[ Ugyldig Facebook-URL ]';
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on November 06, 2015, 09:22:47 AM
Uploaded v2.10 - November 6th, 2015
o Added Norwegian language modifications to the mod.  Thanks, Mimmi (http://www.simplemachines.org/community/index.php?action=profile;u=124177)!
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on November 07, 2015, 11:13:42 AM
Uploaded v2.11 - November 7th, 2015
o Fixed Norwegian language modifications so that they are added to correct language file.
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on November 12, 2015, 03:39:15 PM
Uploaded v2.12 - November 12th, 2015
o Issue already been addressed.  No functional changes made to the mod.
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on November 14, 2015, 11:51:43 AM
Uploaded v2.13 - November 14th, 2015
o Fixed auto-embedding code so that it embeds the URL if no tags are around it.
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on November 30, 2015, 04:53:28 PM
Uploaded v2.14 - November 30th, 2015
o Fixed issue with auto-embed where Facebook tags were removed from code tags.
o Modified auto-embed function for use as a hook with SMF 2.1.
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on December 09, 2015, 09:04:39 AM
Uploaded v2.15 - December 9th, 2015
o Fixed name of CSS file within Subs-BBCode-Facebook.php.  Thanks for the bug report, villasg!
Title: Re: Embed Facebook BBCode
Post by: villasg on December 09, 2015, 09:07:58 AM
Glad to help you ! ! !
Title: Re: Embed Facebook BBCode
Post by: villasg on December 09, 2015, 09:28:49 AM
And i want ask you somethink for help .
In my post.php my line  1534 after install this mod are :
if ($smcFunc['htmltrim'](strip_tags(parse_bbc($_POST['message'], false), '<img><div><div><iframe><iframe><div><div><iframe><iframe><div><iframe><div><iframe><div><iframe><div><object><embed><div><iframe>')) === '' && (!allowedTo('admin_forum') || strpos($_POST['message'], '[html]') === false)) $post_errors[] = 'no_message';
}


I am confused with too many <div> & <iframe> .
Its correct ?

Help please
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on December 09, 2015, 10:16:57 AM
Technically, yes, it is correct, and yes, it works just fine.  If the look of that line matters to you, you can change it to:
if ($smcFunc['htmltrim'](strip_tags(parse_bbc($_POST['message'], false), '<img><div><iframe><object><embed>')) === '' && (!allowedTo('admin_forum') || strpos($_POST['message'], '[html]') === false))
Basically, what I did was eliminated the duplicate <div> and <iframe> strings.  However, keep in mind that doing so will make uninstalling the mods responsible for putting them there more difficult without having to do manual edits.....
Title: Re: Embed Facebook BBCode
Post by: villasg on December 09, 2015, 10:31:42 AM
Thanks
Title: Re: Embed Facebook BBCode
Post by: TLMB on December 09, 2015, 11:32:51 AM
Hi,
I just uninstalled and reinstalled the latest Embed Instagram mod... all fine.

But when I then went to do the same for this mod ( v2.8 ), I had to tweak Post and Subs so that the uninstall would work.
On Post, the
//...something about Instagram
was in front of the
//...something about Facebook
, so I had to switch them round manually so it could be found by the uninstaller.
On Subs,
'<img><div> wasn't found, as it looked like there were a bunch of extra tags in there... duplicated iframe and div tags in the 'wrong' order for it to be found, I assume. (As per villasg's post). So I added a div tag right after the img tag.
The uninstall then proceeded with no errors.
I then installed v2.15, and it installed with no errors.

Now, simple fb post links are not detected/embedded.
BUT if I type [facebook] tags around a link, they *are* embedded.
You can see that in action here: http://kendama.co.uk/forum/index.php/topic,2540.msg21951.html#msg21951

Any ideas?
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on December 09, 2015, 12:09:58 PM
Uploaded v2.16 - December 9th, 2015
o Fixed the auto-embed so that "facebook.com/blah/posts/1234" gets embedded again.




@TLMB: Thank you for the bug report!  This update fixes the auto-embed function so that those links get embedded again.
Title: Re: Embed Facebook BBCode
Post by: TLMB on December 10, 2015, 09:32:48 AM
@Dougie:
You're welcome. Thanks for the update.
I uninstalled 2.15 , then installed 2.16 - no errors.

I then modded the post entry in that link to this:
[EDIT]Currently not working... unless you use [color=red][ facebook ][/color] URL here [color=red][/ facebook ][/color] tags (without the spaces)

For a [b]public[/b] facebook post, just copy the post URL (hover your mouse over the timestamp of the post to get it), and it will be embedded:

Example link A, no tags:
https://facebook.com/BritishKendamaAssociation/posts/979020628816371


Same bare link A, but with www. in the url:
https://www.facebook.com/BritishKendamaAssociation/posts/979020628816371


Example link B, no tags:
https://facebook.com/BritishKendamaAssociation/posts/1003599909691776


Same bare link B, but with www. in the url:
https://www.facebook.com/BritishKendamaAssociation/posts/1003599909691776


Bare link A in [ fb ] tags:
[facebook]https://facebook.com/BritishKendamaAssociation/posts/979020628816371[/facebook]


Bare link A in [ fb ] tags, with www. :
[facebook]https://www.facebook.com/BritishKendamaAssociation/posts/979020628816371[/facebook]


Bare link B, in [ fb ] tags:
[facebook]https://facebook.com/BritishKendamaAssociation/posts/1003599909691776[/facebook]


Bare link B, with www. , in [ fb ] tags:
[facebook]https://www.facebook.com/BritishKendamaAssociation/posts/1003599909691776[/facebook]


Which was only partially successful, as you'll see if you go there again. Some issues with "www."....
:-/
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on December 11, 2015, 09:08:15 AM
Uploaded v2.17 - December 11th, 2015
o Another fix for the auto-embed code so that all facebook URLs get embedded properly.




@TLMB:  Thank you for bringing this to my attention!  I didn't realize one fix that had broken other things in the mod...  :o  I tested against all 8 possibilities, with and without www., with and without http://, and both with and without the facebook tags, and now all seems to work correctly.  Let me know if you find anything else!
Title: Re: Embed Facebook BBCode
Post by: TLMB on December 11, 2015, 03:09:33 PM
Thanks for adding another update.
Quote from: dougiefresh on December 11, 2015, 09:08:15 AMI didn't realize one fix that had broken other things in the mod... 
In my limited experience, that's sadly very often the way!

I uninstalled 2.16 and installed 2.17. No errors in either case.
Again, the [ fb ] ones were embedded, the unlinked www ones were embedded with a messy url before them, and the unlinked non-www ones were not embedded.

But... I wondered if it might be to do with the post-editing problem I'd had previously ( mentioned here: http://www.simplemachines.org/community/index.php?topic=537616.msg3840168#msg3840168 ), so I replied to the thread in my forum with a new post here:
http://kendama.co.uk/forum/index.php/topic,2540.msg23006.html#msg23006
Unfortunately, the same thing happened.

Then I wondered if it was because it was in an existing thread, so I tried in another, hidden sub-forum, with exactly the same post. This time, in the preview window, all the posts were embedded correctly. But when I actually clicked Post, the same thing as above happened. So, in case it was due to being in a hidden forum, I tried again in a public forum, but the same thing happened, but this time there were no embeds in the Preview window.

I'm beginning to think that this is quite possibly a problem with my installation rather than this mod. I may well be wasting your time, sorry. :-/

In each case, this was the message content:
[EDIT]Currently not working... unless you use [color=red][ facebook ][/color] URL here [color=red][/ facebook ][/color] tags (without the spaces)

For a [b]public[/b] facebook post, just copy the post URL (hover your mouse over the timestamp of the post to get it), and it will be embedded:

Example link A, no tags:
https://facebook.com/BritishKendamaAssociation/posts/979020628816371


Same bare link A, but with www. in the url:
https://www.facebook.com/BritishKendamaAssociation/posts/979020628816371


Example link B, no tags:
https://facebook.com/BritishKendamaAssociation/posts/1003599909691776


Same bare link B, but with www. in the url:
https://www.facebook.com/BritishKendamaAssociation/posts/1003599909691776


Bare link A in [ fb ] tags:
[facebook]https://facebook.com/BritishKendamaAssociation/posts/979020628816371[/facebook]


Bare link A in [ fb ] tags, with www. :
[facebook]https://www.facebook.com/BritishKendamaAssociation/posts/979020628816371[/facebook]


Bare link B, in [ fb ] tags:
[facebook]https://facebook.com/BritishKendamaAssociation/posts/1003599909691776[/facebook]


Bare link B, with www. , in [ fb ] tags:
[facebook]https://www.facebook.com/BritishKendamaAssociation/posts/1003599909691776[/facebook]

==

Trying http instead of https:
https://facebook.com/BritishKendamaAssociation/posts/979020628816371

https://www.facebook.com/BritishKendamaAssociation/posts/979020628816371
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on December 11, 2015, 07:58:39 PM
Well, I tested the auto-embed function with the contents of the code tags both outside the forum (using a test script with SSI) and inside the forum.  It performed as expected with this last update....  I personally have no idea why it would act differently from one board to another.....  :o  While I'm working tomorrow doing my light duty work (yeah, I'm injured), I'll think about it....  Maybe something will come to me....
Title: Re: Embed Facebook BBCode
Post by: BeatsMe on December 14, 2015, 04:21:23 AM
Just wondering if I can get some help regarding how Facebook and embedding works this regards to this mod, as I am having some unusual results when using this on my forum.... I hope this is not outside the scope of the support topic.

I'm having problems where for example a video post that works fine for me will not work for some others and all they see the FB message "Video Unavailable This video may no longer exist, or you don't have permission to view it".

However, if you manually copy the FB link to a new browser tab the video works fine.

An example of a video that i see the error as above when embedded, but yet it works fine with a browser...
https://www.facebook.com/khwaja.syd/videos/10207586553968394/

Here is an example video that embeds fine for me, but yet others have said it wont work...
https://www.facebook.com/100010412172081/videos/153225255034546/


Not saying this is a bug with this mod, just wanting to see if there is a simple explanation of how this is working.
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on December 14, 2015, 07:13:25 PM
Let me look into it....
Title: Re: Embed Facebook BBCode
Post by: BeatsMe on December 15, 2015, 03:59:35 AM
ok, small update to my original post here...

Quote from: BeatsMe on December 14, 2015, 04:21:23 AM
An example of a video that i see the error as above when embedded, but yet it works fine with a browser...
https://www.facebook.com/khwaja.syd/videos/10207586553968394/

This is and always has been shared as "public", so I don't at this point understand why it will not embed with this mod.


Quote from: BeatsMe on December 14, 2015, 04:21:23 AM
Here is an example video that embeds fine for me, but yet others have said it wont work...
https://www.facebook.com/100010412172081/videos/153225255034546/

This FB link was originally shared as "friends" only, it has now been changed to "public" and seems to now be working for the members that said it was not working.  So ignore this problem.
Title: Re: Embed Facebook BBCode
Post by: BeatsMe on December 15, 2015, 04:11:45 AM
Also, one other thing that might be easier to fix than my other posts...

I have noticed that if I post a FB link within the [ CODE ] bbcode on my forum, the [ FACEBOOK ] bbcode is automatically added inside the [ CODE ] bbcode.

Like this...

https://www.[facebook]facebook.com/100010412172081/videos/153225255034546/[/facebook]
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on December 18, 2015, 07:40:27 PM
Quote from: BeatsMe on December 15, 2015, 04:11:45 AM
I have noticed that if I post a FB link within the [ CODE ] bbcode on my forum, the [ FACEBOOK ] bbcode is automatically added inside the [ CODE ] bbcode.
Fixed this for next version.....

Quote from: BeatsMe on December 14, 2015, 04:21:23 AM
An example of a video that i see the error as above when embedded, but yet it works fine with a browser...
https://www.facebook.com/khwaja.syd/videos/10207586553968394/
Not saying this is a bug with this mod, just wanting to see if there is a simple explanation of how this is working.
Puzzled over this one.....
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on December 21, 2015, 07:33:45 PM
Uploaded v2.18 - December 21th, 2015
o Added support for Facebook photos as posts
o Added auto-embed support for Facebook photo posts




@BeatsMe: I found Facebook's Embedded Posts - Social Plugins (https://developers.facebook.com/docs/plugins/embedded-posts) page, which can give the HTML code to embed the video.  I put in the video URL into their generator, and whaalaa.....  nothing.  I get the following:
This Facebook post is no longer available. It may have been removed or the privacy settings of the post may have changed.
So I think it's something on FB's side, not of this mod, because I can play other PUBLIC FB videos using their URL.....
Title: Re: Embed Facebook BBCode
Post by: Ninja ZX-10RR on December 27, 2015, 07:51:32 PM
So this is weird dougie... Whenever I install this particular mod I get literally thousands of errors (2 for every page load) like this:
8: Undefined index: forum_name
  File: /default/languages/index.english.php
Line: 113

And that line is this string
$txt['regards_team'] = 'Regards,' . "\n" . 'The ' . $context['forum_name'] . ' Team.';
If you have any ideas on what could possibly conflict with, feel free to give me an hint :)

Note: I cannot reproduce this on a default forum :/
Title: Re: Embed Facebook BBCode
Post by: BeatsMe on December 28, 2015, 05:16:21 AM
Quote from: dougiefresh on December 21, 2015, 07:33:45 PM
@BeatsMe: I found Facebook's Embedded Posts - Social Plugins (https://developers.facebook.com/docs/plugins/embedded-posts) page, which can give the HTML code to embed the video.  I put in the video URL into their generator, and whaalaa.....  nothing.  I get the following:
This Facebook post is no longer available. It may have been removed or the privacy settings of the post may have changed.
So I think it's something on FB's side, not of this mod, because I can play other PUBLIC FB videos using their URL.....

Ok, thanks for your help.

Very random functionality, even within Facebook themselves.... that video is public, and works on a separate browser tab.... but, for some stupid unknown reason will not embed.

Anyway, for the most part your mod seems to be working well on my forum... expect for a few videos/members.
Title: Re: Embed Facebook BBCode
Post by: d3vcho on December 28, 2015, 06:09:15 AM
Translation to Spanish ;)

Nice Mod!
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on December 28, 2015, 07:38:20 AM
Uploaded v2.19 - December 28th, 2015
o Added Spanish translation to the mod, courtsey of d3vcho (http://www.simplemachines.org/community/index.php?action=profile;u=422971)




@d3vcho: Thank you for the Spanish translation!  It's been included in this update!

@Everybody: Updating to this version is unnecessary unless you want a Spanish translation!

@Ninja ZX-10RR: Ummmm.....  Weird.  Look at the top of index.english.php.  Do you have something like this at the top?
global $forum_copyright, $forum_version, $webmaster_email, $scripturl, $context, $boardurl;
If not, I would advise putting something like that in your index.english.php.  At the very least, it needs to contain
global $context;
I don't know about the rest, but the mod doesn't make any changes to that line, so I'm at a loss as to why your forum is doing this....
Title: Re: Embed Facebook BBCode
Post by: Ninja ZX-10RR on December 28, 2015, 03:23:47 PM
Yep, it's there:
global $forum_copyright, $forum_version, $webmaster_email, $scripturl, $context, $boardurl;
I'm at a loss as well, as soon as I install it it looks like it doesn't parse that $context any longer and throws error ._.
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on December 28, 2015, 09:06:01 PM
Quote from: Ninja ZX-10RR on December 28, 2015, 03:23:47 PM
Yep, it's there:
global $forum_copyright, $forum_version, $webmaster_email, $scripturl, $context, $boardurl;
I'm at a loss as well, as soon as I install it it looks like it doesn't parse that $context any longer and throws error ._.
Can you attach your index.english.php so that I maybe can see what happens?  I'm thinking maybe there is something wrong with your language file....  (Although I can't imagine what at this point....)  If that isn't it, there's a problem with your forum source....
Title: Re: Embed Facebook BBCode
Post by: Ninja ZX-10RR on December 28, 2015, 09:12:25 PM
I don't think there are any errors in there, as they work fine without the mod, for some reason. But viceversa it doesn't work with it, it's so weird. Then again I have around 140 mods installed, but these are really the only errors in the log, had to uninstall it because it spammed literally 400+ errors in a couple of minutes.
When I found out I was like "let's just randomly check the log to see the usual previous errors that I fixed..." *boom* /sees 60k results /lolwut.

P.S.: I use utf-8, of course, so I attached both. Even more weird I get errors exclusively related to action=dlattach;attach=xx;type=avatar BOTH in utf8 and non-utf8 files.
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on December 28, 2015, 09:24:46 PM
Quote from: Ninja ZX-10RR on December 28, 2015, 09:12:25 PM
Even more weird I get errors exclusively related to action=dlattach;attach=xx;type=avatar BOTH in utf8 and non-utf8 files.
Oooh....  Please attach Sources/Display.php, then....

Btw, your index.english* files are good, as far as $context is concerned....  I'll look at your Display.php tomorrow morning.  I'm going to bed now.
Title: Re: Embed Facebook BBCode
Post by: Ninja ZX-10RR on December 28, 2015, 10:22:17 PM
Here it is, thanks for looking btw! :)

I see the avatar stuff is into the download function, I should note that on my forum the attachments part has been recoded (as well as the whole theme, lol), as it doesn't have the built-in system (it's hidden via template), and has been replaced by a third party one, I think it was based on Bugo's "External uploader (http://dragomano.ru/page/mods-for-smf-english)" although unless I'm mistaken I have customized it even further and linked it to forum permissions, replacing the previous system. Can't recall any edits to Display.php though, mostly template stuff.

Quote from: dougiefresh on December 28, 2015, 09:24:46 PM
I'll look at your Display.php tomorrow morning.  I'm going to bed now.
Please don't rush, you are being super-kind already, as always.
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on December 29, 2015, 09:40:44 AM
Hmmm.... Nothing obvious there, either....  Man, there are so many other places that COULD have the problem in it....  I don't know....
Title: Re: Embed Facebook BBCode
Post by: Ninja ZX-10RR on December 29, 2015, 05:40:19 PM
With some help by a much more badass guy than me :P
It looks like this part // FACEBOOK BBCODE: Include the language setting in the $userinfo array....
loadLanguage('index');
calls the index language before the $context is being defined, which is why it triggers an error, not sure why it only happens on my specific configuration so far.
Title: Re: Embed Facebook BBCode
Post by: margarett on December 29, 2015, 06:57:27 PM
Do note, there is a similar issue in discussion at GH involving SMF 2.1
https://github.com/SimpleMachines/SMF2.1/issues/3137
(no MODs involved)

And I am also checking an issue exactly like this
Quote from: Ninja ZX-10RR on December 28, 2015, 09:12:25 PM
I get errors exclusively related to action=dlattach;attach=xx;type=avatar

The same setup seems to trigger errors in a computer and not in another computer. It's dang awkward and it might not exactly relate to this MOD...

Title: Re: Embed Facebook BBCode
Post by: dougiefresh on December 29, 2015, 08:24:21 PM
Uploaded v2.20 - December 29th, 2015
o Fixed Spanish XML file so that it doesn't result in errors when Spanish isn't installed.
o Moved code from XML file into the PHP file to set the user's default facebook language.




@Ninja ZX-10RR: Huh, I wouldn't have guessed that one....  The fact that it's not reproducable in a clean forum makes it much harder to diagnose.  I've tried to fix it for this version!  Thanks for the bug report!

Btw, I don't remember why I loaded the index language file at that point.....  It doesn't appear to be used by the hook functions....

@margarett: Hmmmm....  I'll read that discussion....  Thanks for pointing it out to me!
Title: Re: Embed Facebook BBCode
Post by: Ninja ZX-10RR on December 30, 2015, 04:46:43 AM
And it works as well! No more errors! Thanks a ton dougie, as always :D
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on December 30, 2015, 05:13:58 PM
Uploaded v2.21 - December 30th, 2015
o Fixed issue where Facebook language set to default Facebook language, not user's language.
o Fixed photo URLs so that URLs with "&theater" in them display properly.
o Fixed auto-embed for Facebook videos.
o Fixed code for Facebook usernames with decimal points or underscores in them.
o Added new Facebook photo post format recognition.




@Everybody: Since my localhost test forum crashed (for no obvious reason), I've been having to rebuild it, developing posts with every possible represented URL.  I've found several that just didn't work, and have fixed the mod to take care of those situations.  This mod addresses those concerns....
Title: Re: Embed Facebook BBCode
Post by: BeatsMe on January 02, 2016, 04:22:46 PM
Thank you for this update... Will reinstall soon  8)
Title: Re: Embed Facebook BBCode
Post by: Ninja ZX-10RR on January 02, 2016, 05:33:43 PM
Hmm, not sure about older versions but last version has quite many validation errors and won't validate in w3c, it threw me like 7 errors as soon as I checked. I'm very tired right now so I didn't dig into the code, might have a look tomorrow unless you are faster than me, lol.
Title: Re: Embed Facebook BBCode
Post by: Ninja ZX-10RR on January 04, 2016, 04:57:49 AM
Subs-BBCode-Facebook.php
Code (find) Select
<script src="//connect.facebook.net/' . $user_info['facebook_lang'] . '/sdk.js#xfbml=1&version=v2.3" async></script>';
Code (replace with) Select
<script src="//connect.facebook.net/' . $user_info['facebook_lang'] . '/sdk.js#xfbml=1&amp;version=v2.3" type="text/javascript"></script>'; (not sure how you can do async but never validates, had the same problem myself with another js file. Not sure wtf is wrong with the site either, there is no initial space in the second line, yet it shows as indented... ._. EDIT: puah, fixed, I call it a bug though, will try to reproduce it consistently.

The line above fixes 4 errors, but leaves other 2 that I cannot find at the moment, I'm probably too sleepy.
Line 399, Column 72: there is no attribute "data-href"
...g_399"><div class="fb-post" data-href="https://www.facebook.com/MyFacebookID/p...

Line 399, Column 184: there is no attribute "data-width"
...10745650514?viewas=100000686899395&amp;pnref=story" data-width="0"></div></div>

Can you look into these please?

Thanks in advance :)
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on January 04, 2016, 05:45:02 PM
Quote from: Ninja ZX-10RR on January 04, 2016, 04:57:49 AM
Subs-BBCode-Facebook.php
Code (find) Select
<script src="//connect.facebook.net/' . $user_info['facebook_lang'] . '/sdk.js#xfbml=1&version=v2.3" async></script>';
Code (replace with) Select
<script src="//connect.facebook.net/' . $user_info['facebook_lang'] . '/sdk.js#xfbml=1&amp;version=v2.3" type="text/javascript"></script>'; (not sure how you can do async but never validates, had the same problem myself with another js file. Not sure wtf is wrong with the site either, there is no initial space in the second line, yet it shows as indented... ._. EDIT: puah, fixed, I call it a bug though, will try to reproduce it consistently.
Fixed for next version!  Thanks!

Quote from: Ninja ZX-10RR on January 04, 2016, 04:57:49 AM
The line above fixes 4 errors, but leaves other 2 that I cannot find at the moment, I'm probably too sleepy.
Line 399, Column 72: there is no attribute "data-href"
...g_399"><div class="fb-post" data-href="https://www.facebook.com/MyFacebookID/p...

I don't think I can "fix" these, as it is specified by the Facebook API/docs to use these for passing the Facebook URL to the javascript.....

Quote from: Ninja ZX-10RR on January 04, 2016, 04:57:49 AM
Line 399, Column 184: there is no attribute "data-width"
...10745650514?viewas=100000686899395&amp;pnref=story" data-width="0"></div></div>

Kinda fixed for the next version, with same notes as the "data-href" attribute....
Title: Re: Embed Facebook BBCode
Post by: Ninja ZX-10RR on January 05, 2016, 09:44:25 AM
You're welcome :)

I see what you mean for the other 2. It'd be necessary to retrieve this https://connect.facebook.net/en_us/sdk.js#xfbml=1&version=v2.3 and then all the other languages javascript files, somehow patch them (I got an headache as soon as I opened it, I hate javascript, really), code a small script to patch all of them and place them on people's servers instead of relying on facebook ones, so edit the url where the mod is calling them as well... --> Nightmare.

Another way around could be using a very accurate preg_replace, could be a lot easier, but need to figure out how to patch it first, and I am not sure about it.
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on January 05, 2016, 10:04:16 AM
Quote from: Ninja ZX-10RR on January 05, 2016, 09:44:25 AM
I see what you mean for the other 2. It'd be necessary to retrieve this https://connect.facebook.net/en_us/sdk.js#xfbml=1&version=v2.3 and then all the other languages javascript files, somehow patch them (I got an headache as soon as I opened it, I hate javascript, really), code a small script to patch all of them and place them on people's servers instead of relying on facebook ones, so edit the url where the mod is calling them as well... --> Nightmare.
PASS

EDIT: My reasons: I don't mind building a Javascript file, but modifying FB's to "suit our purposes" doesn't seem like a good idea.  Plus, if the API changes, our modified JS file may be permanently broken.  And I don't particular feel like modifying the mod every time FB makes a change to the API....

Quote from: Ninja ZX-10RR on January 05, 2016, 09:44:25 AM
Another way around could be using a very accurate preg_replace, could be a lot easier, but need to figure out how to patch it first, and I am not sure about it.
Again, PASS!
Title: Re: Embed Facebook BBCode
Post by: Ninja ZX-10RR on January 05, 2016, 10:04:40 AM
LOL ;D Can't really blame you ahah ;D
Title: Re: Embed Facebook BBCode
Post by: TLMB on January 21, 2016, 12:34:53 PM
Any chance of adding support for posts that appear on event pages: e.g. of the form https://www.facebook.com/events/718775158259301/permalink/735868509883299/ ? Thanks.
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on January 22, 2016, 08:07:23 AM
Uploaded v2.22 - January 22th, 2016
o Added support for Facebook event permalinks.




@TLMB: Your feature request has been implemented!  Thank you!
Title: Re: Embed Facebook BBCode
Post by: TLMB on January 22, 2016, 11:02:21 AM
Thanks very much.
The auto-embed is still not working for me on my forum (and like I said before, that's probably my problem, not yours), but they work when using the tags/button, so that's what I'm telling people to do now.
Cheers!
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on February 04, 2016, 11:38:51 AM
I'll take a look once I am mobile enough to get to my computer.  I am recovering from knee surgery....
Title: Re: Embed Facebook BBCode
Post by: JF3000 on February 06, 2016, 07:10:25 AM
Installed successfully. Go to grab a post and place it inbetween the facebook comments after clicking the button in a new post and preview and nothing is displayed.
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on February 07, 2016, 06:38:36 PM
Installed the mod on a clean forum and can confirm this bug report.  Let me try to fix the problem....
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on February 10, 2016, 11:27:56 AM
UPDATE: I think I've found a solution to the problem within the SDK.  It does allow reparsing the HTML to deal with Facebook stuff added after the initial load....
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on February 10, 2016, 01:57:02 PM
Uploaded v3.0 - February 10th, 2016
o Fixed issue where Facebook URLs shown in preview mode aren't parsed by Facebook SDK.




@JF3000: This update fixes the issue you reported.  Thank you!
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on February 14, 2016, 04:41:13 PM
Uploaded v3.1 - February 14th, 2016
o Removed 25 pixel top border from the video iframe div box.
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on March 07, 2016, 02:05:53 PM
Uploaded v3.2 - March 7th, 2016
o Modified auto-embed code so that Facebook URLs in signature are embedded as [url]{link}[/url].
Title: Re: Embed Facebook BBCode
Post by: villasg on March 11, 2016, 07:24:21 AM
Quote from: dougiefresh on March 07, 2016, 02:05:53 PM
Uploaded v3.2 - March 7th, 2016
o Modified auto-embed code so that Facebook URLs in signature are embedded as [url]{link}[/url].

Please fix the package-info.xml and make the <version>3.1</version> -----> <version>3.2</version>
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on March 12, 2016, 04:43:42 PM
Whoops!  Sorry bout that!  It's been fixed and reuploaded....
Title: Re: Embed Facebook BBCode
Post by: Tiribulus on May 29, 2016, 05:42:04 PM
Hello sir,
I'm not sure why this is, but any addresses to a specific permalink location that work fine in the browser return [ Invalid Facebook URL ] when put between the tags in a post. I did search first, but only found a post saying that this message would come up for invalid urls. It doesn't however say what those are and one would think that whatever works in a browser, assuming it's a public group the url is from, should work.
Thanks for this mod and your help
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on June 01, 2016, 02:38:18 PM
@Tiribulus:  An example of what URL you are trying to use would be helpful.....
Title: Re: Embed Facebook BBCode
Post by: Tiribulus on June 01, 2016, 03:55:40 PM
Sorry man. I guess that would have been helpful indeed.  :o
https://www.facebook.com/todd.pruitt.9/posts/10154218844149138?comment_id=10154220418084138&comment_tracking={%22tn%22%3A%22R%22}
Don't ask me what goin on here, but today the links work, but ignore everything after:
https://www.facebook.com/todd.pruitt.9/posts/10154218844149138?
When I posted this question, it gave the [ Invalid Facebook URL ] error if anything after the above was included in the link. Now it links to the main FB post, which I'm thinking is what it's supposed to do. It would be great if it would display the comment that the permalink was too instead of the main post, but this is still great and useful as is.

I hope all that made sense.
Title: Re: Embed Facebook BBCode
Post by: Tiribulus on June 02, 2016, 06:05:55 PM
This url just gave me the error :)
https://www.facebook.com/permalink.php?story_fbid=1093223780736842&id=165284543530775
Title: Re: Embed Facebook BBCode
Post by: -Rock Lee- on June 02, 2016, 07:05:33 PM
I am that there is already a translation into Spanish, but here I leave the Latin version has a slight change  8)



Regards!
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on June 19, 2016, 05:08:09 PM
I'm sorry that it's taking me so long to resolve these issues.  Life has been hell lately.....

@Rock Lee: I've got your translation included for the next version of the mod.  Thank you!

@Tiribulus:  I've got the mod working for the following link, when used with AND without the [facebook] tags:
https://www.facebook.com/permalink.php?story_fbid=1093223780736842&id=165284543530775

This link works just fine with you surround it with the [facebook] tag:
https://www.facebook.com/todd.pruitt.9/posts/10154218844149138?comment_id=10154220418084138&comment_tracking={%22tn%22%3A%22R%22}
BUT it doesn't want to auto-embed properly.  So far, the closest I've gotten it is to link to the FB post here:
Quotehttps://www.facebook.com/todd.pruitt.9/posts/10154218844149138?comment_id=10154220418084138
with
Quote&comment_tracking={%22tn%22%3A%22R%22}
following the Facebook post.....
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on June 19, 2016, 06:19:42 PM
Uploaded v3.3 - June 18th, 2016
o Added Spanish Latin translation, courtsey of Rock Lee (http://www.simplemachines.org/community/index.php?action=profile;u=322597).
o Fixed code so that the Facebook permalink.php URL is recognized as valid.
o Fixed auto-embed code so that the Facebook permalink.php URL is recognized as valid.
Title: Re: Embed Facebook BBCode
Post by: Paracelsus on August 01, 2016, 07:42:50 PM
Hi dougiefresh,

Your MOD works really well.  The only thing I noticed so far is the fact that embedded posts don't seem to scale/work responsive. Videos scale nicely, but not posts. According to facebook, "On mobile web, Embedded Posts automatically scale to the width of the container." (https://developers.facebook.com/docs/plugins/embedded-posts) but it doesn't seem to work on mine.
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on September 26, 2016, 10:54:30 AM
Quote from: Paracelsus on August 01, 2016, 07:42:50 PM
Hi dougiefresh,

Your MOD works really well.  The only thing I noticed so far is the fact that embedded posts don't seem to scale/work responsive. Videos scale nicely, but not posts. According to facebook, "On mobile web, Embedded Posts automatically scale to the width of the container." (https://developers.facebook.com/docs/plugins/embedded-posts) but it doesn't seem to work on mine.
I'll work on this request.  I've got to perform some magic mumbo-jumbo in order to get everything to work properly, though....
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on September 26, 2016, 03:47:14 PM
Uploaded v3.4 - September 26th, 2016
o Altered code to make regular and permalink post URLs responsive.
o Altered code to make video URLs responsive using Facebook code.
o Fixed regex pattern to accept photo.php URLs without the theater param.
o Removed BBCode-Facebook2.css from the mod, since it was unused.




Quote from: Paracelsus on August 01, 2016, 07:42:50 PM
The only thing I noticed so far is the fact that embedded posts don't seem to scale/work responsive.
Thank you for the bug report!  I'm pretty sure I've fixed it with this version....
Title: Re: Embed Facebook BBCode
Post by: villasg on September 27, 2016, 07:58:36 AM
Hi.
thanks for the update .
I ask you , need remove the old ( 3.2 ) version and install the new or its simple to replace the file :  Subs-BBCode-Facebook.php ?

Thanks 

Ps i ask the same for the mod : EMBED INSTAGRAM BBCODE v1.19 ( to make  update from 1.18 )
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on September 27, 2016, 09:19:21 PM
Quote from: villasg on September 27, 2016, 07:58:36 AM
I ask you , need remove the old ( 3.2 ) version and install the new or its simple to replace the file :  Subs-BBCode-Facebook.php ?
Ps i ask the same for the mod : EMBED INSTAGRAM BBCODE v1.19 ( to make  update from 1.18 )
I don't believe either mod changed anything other than the Subs-BBCode-Facebook.php file (and Subs-BBCode-Instagram.php for the Embed Instagram BBCode mod).  So you should be able to upgrade simply by replacing the old file with the new.....
Title: Re: Embed Facebook BBCode
Post by: Tiribulus on November 29, 2016, 05:07:07 PM
Do you know why I'm getting [ Invalid Facebook URL ] ?

Thanks  :)
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on November 29, 2016, 09:01:27 PM
Quote from: Tiribulus on November 29, 2016, 05:07:07 PM
Do you know why I'm getting [ Invalid Facebook URL ] ?
Probably because there are other possiblities that the mod doesn't recognize as valid.  I can't fix the mod without more information, such as the URL you are trying to use.....
Title: Re: Embed Facebook BBCode
Post by: Tiribulus on November 29, 2016, 09:25:35 PM
Sorry man. I guess the address would have been good huh?  O:)

https://www.facebook.com/grayson.gilbert.585
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on November 29, 2016, 10:00:19 PM
Quote from: Tiribulus on November 29, 2016, 09:25:35 PM
Sorry man. I guess the address would have been good huh?  O:)

https://www.facebook.com/grayson.gilbert.585
Yeah.  The URL is helpful....  The reason that the mod is giving you that response is that the URL is pointing to your Facebook page, not a specific post.  You need to specify a Facebook post.  The easiest method of getting a post URL from Facebook is right-clicking on the time underneath the Facebook name (in this case: Grayson Gilbert), then paste it where you want it in your post.
Title: Re: Embed Facebook BBCode
Post by: Tiribulus on November 29, 2016, 10:12:20 PM
Oh, it has to be a post. I didn't realize that. Sorry and thanks :)

I'll give it a try
Title: Re: Embed Facebook BBCode
Post by: Xpresskonami on May 12, 2017, 07:47:49 AM
This mod is not displaying on my forum. it only gives blank page
Title: Re: Embed Facebook BBCode
Post by: nsno on July 23, 2017, 08:04:51 AM
would it be possible to embed events pages?

I'm not sure if Facebook offers the ability to do that mind?

here's an event page to see if it does?

https://www.facebook.com/events/443557269360601/
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on July 23, 2017, 10:44:35 AM
Quote from: nsno on July 23, 2017, 08:04:51 AM
would it be possible to embed events pages?
I modified the code to attempt to do so, and got the result shown in the attachment....

So, I did more digging on the internet.  I found this on How to Embed Facebook Events on a Site (http://itstillworks.com/embed-facebook-events-32888.html) website:
Quote
The event page can't be embedded, but a post about the event can. If you can't easily find a post about the event you can create one. From the event page, copy the URL from your browser's address bar. Browse to the public page on Facebook to which you want to post the event. In the status box, type something about the event, and then paste in the URL of the event. Wait for Facebook to recognize the URL and generate a preview. After that you can delete the URL from the text of the post, if you wish, and the link will remain.
Hope this helps....
Title: Re: Embed Facebook BBCode
Post by: nsno on July 23, 2017, 01:27:40 PM
Quote from: dougiefresh on July 23, 2017, 10:44:35 AM
Quote from: nsno on July 23, 2017, 08:04:51 AM
would it be possible to embed events pages?
I modified the code to attempt to do so, and got the result shown in the attachment....

So, I did more digging on the internet.  I found this on How to Embed Facebook Events on a Site (http://itstillworks.com/embed-facebook-events-32888.html) website:
Quote
The event page can't be embedded, but a post about the event can. If you can't easily find a post about the event you can create one. From the event page, copy the URL from your browser's address bar. Browse to the public page on Facebook to which you want to post the event. In the status box, type something about the event, and then paste in the URL of the event. Wait for Facebook to recognize the URL and generate a preview. After that you can delete the URL from the text of the post, if you wish, and the link will remain.
Hope this helps....

great work, thank you
Title: Re: Embed Facebook BBCode
Post by: mkucuksari on November 22, 2017, 09:25:31 AM
Thanks for this great mod. Just installed and really like it much.

But just noticed that following facebook link gives " Invalid Facebook URL" error. Could you please check it and make it to work if possible ?

https://www.facebook.com/sabhelidivision/photos/pcb.1613093015377601/1613091855377717/?type=3&theater

Title: Re: Embed Facebook BBCode
Post by: dougiefresh on November 22, 2017, 09:50:32 AM
Uploaded v3.5 - November 22th, 2017
o Altered regex patterns to accept /photo/ URLs properly.




@mkucuksari:  Thank you for notifying me that a particular URL doesn't work with this mod.  It has fixed for this version!
Title: Re: Embed Facebook BBCode
Post by: villasg on November 22, 2017, 12:56:39 PM
Hi need remove the old and reinstall , or just replace the "Subs-BBCode-Facebook.php" in "./Sources" folder ?
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on November 22, 2017, 01:07:24 PM
That should work just fine.
Title: Re: Embed Facebook BBCode
Post by: villasg on November 22, 2017, 01:24:35 PM
nice to know , i go to make the replace ! !!
Title: Re: Embed Facebook BBCode
Post by: mkucuksari on November 22, 2017, 04:45:54 PM
Quote from: dougiefresh on November 22, 2017, 09:50:32 AM
Uploaded v3.5 - November 22th, 2017
o Altered regex patterns to accept /photo/ URLs properly.




@mkucuksari:  Thank you for notifying me that a particular URL doesn't work with this mod.  It has fixed for this version!
What a great and fast support  :) It is working perfect now.

One more item I want to share.

Sometimes without writing any extra comments, we only want to share the Facebook link. But in that case, I get a warning that the message is empty.

Is it possible to fix this warning ? For example we can share a YouTube video or a picture link without writing an extra word.

Again many thanks for your great interest.
Title: Re: Embed Facebook BBCode
Post by: mkucuksari on November 22, 2017, 05:09:35 PM
One more small question. As shown at attached, I want to move facebook icon as 3 rd icon, just to near Vimeo icon. How can I do it ?

(http://i65.tinypic.com/dy3el2.jpg)
Title: Re: Embed Facebook BBCode
Post by: mkucuksari on November 23, 2017, 05:41:24 AM
Here is the Turkish Translation


$txt['fb_default_lang'] = 'Facebook kontrollerinde kullanilacak dil secenegi :';
$txt['fb_default_video_width'] = 'Facebook videolarının varsayilan genislik degeri:';
$txt['fb_default_post_width'] = 'Facebook iletilerinin varsayilan genislik degeri:';
$txt['fb_invalid'] = '[ Gecersiz Facebook Linki ]';
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on November 23, 2017, 10:55:40 AM
Quote from: mkucuksari on November 22, 2017, 04:45:54 PM
Sometimes without writing any extra comments, we only want to share the Facebook link. But in that case, I get a warning that the message is empty.
Can you provide a link that does this?

Quote from: mkucuksari on November 23, 2017, 05:41:24 AM
Here is the Turkish Translation

$txt['fb_default_lang'] = 'Facebook kontrollerinde kullanilacak dil secenegi :';
$txt['fb_default_video_width'] = 'Facebook videolarının varsayilan genislik degeri:';
$txt['fb_default_post_width'] = 'Facebook iletilerinin varsayilan genislik degeri:';
$txt['fb_invalid'] = '[ Gecersiz Facebook Linki ]';

I appreciate the translation, but which language file do I place those lines in?

Quote from: mkucuksari on November 22, 2017, 05:09:35 PM
One more small question. As shown at attached, I want to move facebook icon as 3 rd icon, just to near Vimeo icon. How can I do it ?
It is not possible to change the position of the bbcode buttons at this time.....
Title: Re: Embed Facebook BBCode
Post by: mkucuksari on November 23, 2017, 04:03:35 PM
Quote from: dougiefresh on November 23, 2017, 10:55:40 AM
Can you provide a link that does this?
Here is two example facebook link.

[facebook]www.facebook.com/sabhelidivision/photos/pcb.1613093015377601/1613091855377717/?type=3&theater[/facebook]
[facebook]https://www.facebook.com/biliyoomuydun/videos/2404785083079271/[/facebook]

Quote from: dougiefresh on November 23, 2017, 10:55:40 AM
I appreciate the translation, but which language file do I place those lines in?
Please find the files at attached.

Quote from: dougiefresh on November 23, 2017, 10:55:40 AM
It is not possible to change the position of the bbcode buttons at this time.....
Hope we can get this feature soon.
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on November 23, 2017, 11:50:07 PM
Quote from: mkucuksari on November 23, 2017, 04:03:35 PM
Here is two example facebook link.

[facebook]www.facebook.com/sabhelidivision/photos/pcb.1613093015377601/1613091855377717/?type=3&theater[/facebook]
[facebook]https://www.facebook.com/biliyoomuydun/videos/2404785083079271/[/facebook]
I've tried these links on a clean SMF 2.0.15 forum and cannot duplicate the bug report.....  Can't fix what I can't duplicate....
Title: Re: Embed Facebook BBCode
Post by: mkucuksari on November 24, 2017, 12:48:15 AM
Quote from: dougiefresh on November 23, 2017, 11:50:07 PM
I've tried these links on a clean SMF 2.0.15 forum and cannot duplicate the bug report.....  Can't fix what I can't duplicate....
okey, no problem. Thanks for your interest  ;)
Title: Re: Embed Facebook BBCode
Post by: mkucuksari on November 25, 2017, 03:58:35 PM
My forum users like your mod very much. Again many thanks for this great mod.

As you know, many mobile users use Tapatalk application to access and follow forums and they notice and warn me that Facebook videos can not be seen from Tapatalk. I know Tapatalk could find a solution for this problem but at last years their supports are very bad.

Anyway some of my users ask a simple solution that YouTube mod is also using.

Our suggestion is, will it possible for your to add a direct Facebook link at just below the video frame as shown at attached.So Tapatalk user may see this direct link and by clicking it they can watch the video at Facebook original page.

Some forum owners may not be like this new feature. So if you can add a selection at admin panel, by enabling or disabling this direct Facebook link can be visible.

Hope it is clear enough what and how we ask a new feature from you. If not please ask and I will try more clear.
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on November 26, 2017, 10:26:46 PM
@mkucuksari:  I wish I had some clue as to how to fix this issue with Tapatalk....  Some of my other bbcodes aren't getting translated through the Tapatalk addon, either....
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on November 26, 2017, 10:48:11 PM
UPDATE:  I found the problem with Tapatalk!  Instead of doing operations to change SMF's core files to do its "dirty work", it uses it's own version of the files.  The mod I have installed uses SMF 2.0.11 files....  So now I have some idea of where to edit files so that stuff works....

As a side note, this discovery helped me get my custom bbcodes on my forum working through Tapatalk....  O:)  Maybe I can also get many other mods working with Tapatalk, as well....
Title: Re: Embed Facebook BBCode
Post by: mkucuksari on November 27, 2017, 01:27:37 AM
Quote from: dougiefresh on November 26, 2017, 10:48:11 PM
UPDATE:  I found the problem with Tapatalk!  Instead of doing operations to change SMF's core files to do its "dirty work", it uses it's own version of the files.  The mod I have installed uses SMF 2.0.11 files....  So now I have some idea of where to edit files so that stuff works....

As a side note, this discovery helped me get my custom bbcodes on my forum working through Tapatalk....  O:)  Maybe I can also get many other mods working with Tapatalk, as well....
Great news  :D Waiting the new version  :)
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on November 27, 2017, 10:56:45 AM
Uploaded v3.6 - November 27th, 2017
o Added Turkish translation, courtsey of mkucuksari (https://www.simplemachines.org/community/index.php?action=profile;u=351405)!
o Added Tapatalk support so that any Facebook links show up as clickable links.
o Added option to show the Facebook URL after the Facebook post/video/photo/etc.




@mkucuksari:  Thank you for the translation, as well as the bug report and new option idea!  They have been included in this version!

Attached is a screenshot from my phone of the Tapatalk test thread I used....
Title: Re: Embed Facebook BBCode
Post by: villasg on November 27, 2017, 01:29:35 PM
Quote from: villasg on November 22, 2017, 12:56:39 PM
Hi need remove the old and reinstall , or just replace the "Subs-BBCode-Facebook.php" in "./Sources" folder ?

Same trick again for new version ?
Title: Re: Embed Facebook BBCode
Post by: mkucuksari on November 27, 2017, 03:26:03 PM
Quote from: dougiefresh on November 27, 2017, 10:56:45 AM
Uploaded v3.6 - November 27th, 2017
o Added Turkish translation, courtsey of mkucuksari (https://www.simplemachines.org/community/index.php?action=profile;u=351405)!
o Added Tapatalk support so that any Facebook links show up as clickable links.
o Added option to show the Facebook URL after the Facebook post/video/photo/etc.




@mkucuksari:  Thank you for the translation, as well as the bug report and new option idea!  They have been included in this version!

Attached is a screenshot from my phone of the Tapatalk test thread I used....
Uninstalled the old version and installed the new one.

Everything is working perfect  ;) Many thanks @dougiefresh, you did a great job.
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on November 29, 2017, 12:16:07 PM
Uploaded v3.7 - November 29th, 2017
o Revised Tapatalk support to return Facebook URL only if we can match a pattern.
o Streamlined some code in the bbcode validation function.




@Everybody:  Please upgrade your forum to this version.  The URL validation code in version 3.6 is skipped when using the Tapatalk app to show Facebook bbcodes, which could possibly be a security issue....  Thankfully, the mod doesn't use <iframe> html tags, otherwise, it'd be a major security issue....

Yes, you can upgrade from older versions by replacing the Subs-BBCode-Facebook.php file in Sources....
Title: Re: Embed Facebook BBCode
Post by: mkucuksari on November 29, 2017, 07:20:31 PM
Thanks for new update  ;)
Title: Re: Embed Facebook BBCode
Post by: naitram on January 10, 2018, 03:27:56 PM
just added this and found out there is an issue with the pattern matching

for example if the FB page name has a "-" then you always get invalid response

ex:

https://www.facebook.com/harley-davidson/videos/10154941375470765/

i was able to get it to work by modifing the pattern match to allow "-"
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on January 10, 2018, 05:34:58 PM
I'll make that change when I get home tonight.  But it's gonna be a few hours....
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on January 11, 2018, 10:52:28 AM
Uploaded v3.8 - January 11th, 2018
o Modified regex patterns to include dashes in Facebook user names.




@naitram:  This update should solve the problem you reported.  Thank you for the bug report!
Title: Re: Embed Facebook BBCode
Post by: naitram on January 11, 2018, 11:04:11 AM
thanks for the quick update
Title: Re: Embed Facebook BBCode
Post by: villasg on January 11, 2018, 01:59:46 PM
Its safe to upgrade from version V3.7 by replacing the Subs-BBCode-Facebook.php file in Sources ??
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on January 11, 2018, 03:41:28 PM
Quote from: villasg on January 11, 2018, 01:59:46 PM
Its safe to upgrade from version V3.7 by replacing the Subs-BBCode-Facebook.php file in Sources ??
That should be safe to do, since nothing much changed.
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on March 04, 2018, 09:53:15 PM
Uploaded v3.9 - March 4th, 2018
o Fixed an issue that prevents BBC manager from showing bbcodes.
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on May 21, 2018, 10:23:44 PM
Uploaded v3.10 - April 21st, 2018
o Made a few changes to the HTML header code, as suggested by UMH (https://www.simplemachines.org/community/index.php?action=profile;u=590011).
o Moved certain installer code from add_remove_hooks.php to main source file.
o Added package redirect to invoke previously mentioned installer code.




@UMH:  Thank you for the suggestions!  They have been included in this version!
Title: Re: Embed Facebook BBCode
Post by: kitz on August 16, 2018, 10:34:20 AM
Having a problem with this mod.     I've had an older version installed (3.7) which worked fine thanks :)
 
... Until last night when a few people who were using ipads said they could no longer see any trace that there was a video embedded into the post, so I tried to upgrade to the latest version.    I have since I think been on a red herring chase thinking it was something to do Tapatalk, as I had difficulty removing the old version due to a minor file difference in one of the mobique files.

So tapatalk uninstalled, old version of this mod uninstalled.   
Tapatalk reinstalled, Embed FB BBCode 3.10 installed.

Now no-one can see any embedded FB videos and unless I switch on the option to include the url, then it looks like there is an empty post.

I've tried a reinstall but still nothing is working.
The button is there fine and it will add the {facebook} {/facebook} BBcode.  Just no video displayed.
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on August 16, 2018, 10:49:16 PM
Interesting bug report.  I'll look into it.....
Title: Re: Embed Facebook BBCode
Post by: kitz on August 17, 2018, 12:08:51 PM
Thank you.   If you need any more info let me know.
I haven't done any updates other than tapatalk for a while. I'm currently running SMF 2.0.15 with the following mods:

1. Embed Facebook BBCode 3.10
2. Tapatalk SMF 2.0 Plugin 4.5.2
3. GDPR Helper 1.0.4
4. Stop Spammer 2.3.9a
5. Ohara YouTube Embed 1.2.3
6. httpBL


Whilst at first it was just those with i-pads reporting problems, now no-one can view any videos past or present (even those that previously showed ok).

I don't think its relevant, but one of my users noticed that the FB code causes W3 errors with SMF's xhtml.
Title: Re: Embed Facebook BBCode
Post by: kitz on August 17, 2018, 11:04:15 PM
Just had a quick look at Subs-BBCode-Facebook.php and not sure if this is relevant but  jssdk 2.3 is long since deprecated.  The latest version is 3.1

There also appears to have been a change in the url structure
$tag['content'] = '<div class="fb-video" data-href="https://www.facebook.com/video.php?v=' . $parts[5] . '" data-width="'

Video links are now in the format

<div class="fb-video" data-href="https://www.facebook.com/' . $fb_user . '/videos/' . $part . '/" data-width="500" data-show-text="false">


Apols if I've misunderstood your code or if you checked for that in the reg expression which Ive just noticed above that line.
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on October 13, 2018, 12:30:00 PM
Uploaded v3.11 - October 13th, 2018
o No functionality change.
o Updated documentation to point to new website.




@kitz:  I apologize for the late response to your bug report.  I'll look into it!
Title: Re: Embed Facebook BBCode
Post by: kitz on November 04, 2018, 10:59:00 AM
Thank you, I'd appreciate it if you would.   I've not been able to get it to work for several months now.
Same issue with 3.11
Title: Re: Embed Facebook BBCode
Post by: FishingManMatt on November 19, 2018, 06:58:17 AM
Hi dougiefresh!
First of all, thank you for your mod.

Just wanted to report the same bug which Suki had made in his Ohara YouTube Embed mod.
I described the bug in this post (https://www.simplemachines.org/community/index.php?topic=462968.msg3896344#msg3896344).

In the installation script you can find the following:
<file name="$sourcedir/Post.php">
<operation>
<search position="replace"><![CDATA['<img>]]></search>
<add><![CDATA['<img><div>]]></add>
</operation>
<operation>
<search position="replace"><![CDATA['<img>]]></search>
<add><![CDATA['<img><div>]]></add>
</operation>
</file>


which results in:
<img><div><div>


Another issue worth to mention:
I think that many people use both mods Embed Facebook BBCode and Ohara YouTube Embed and both mods modify the same img tag in different manner:

Ohara YouTube Embed converts the img tag into:
<img><iframe><video><div>

Embed Facebook BBCode into:
<img><div>

Maybe there is some way to unify this code for both mods?

Best regards
Matt
Title: Re: Embed Facebook BBCode
Post by: Cola-Coca on January 27, 2019, 06:41:06 PM
Helo,

I installed the mod and after installation when I put something between tags '[facebook]facebook link[/facebook]' in the end I get nothing, as if I did not write anything in the post. :(

I have instaled 'Embed_Facebook_BBCode_v3.11'.
Title: Re: Embed Facebook BBCode
Post by: Ninja ZX-10RR on January 28, 2019, 07:48:53 AM
Quote from: Cola-Coca on January 27, 2019, 06:41:06 PM
Helo,

I installed the mod and after installation when I put something between tags '[facebook]facebook link[/facebook]' in the end I get nothing, as if I did not write anything in the post. :(

I have instaled 'Embed_Facebook_BBCode_v3.11'.
Buddy, you have 3.5k posts, you should know very well that when you have a problem you must give some context... Link to see the problem, errors, something...
Title: Re: Embed Facebook BBCode
Post by: Cola-Coca on January 28, 2019, 12:06:02 PM
Quote from: Ninja ZX-10RR on January 28, 2019, 07:48:53 AM
Quote from: Cola-Coca on January 27, 2019, 06:41:06 PM
Helo,

I installed the mod and after installation when I put something between tags '[facebook]facebook link[/facebook]' in the end I get nothing, as if I did not write anything in the post. :(

I have instaled 'Embed_Facebook_BBCode_v3.11'.
Buddy, you have 3.5k posts, you should know very well that when you have a problem you must give some context... Link to see the problem, errors, something...

Yes you're right.
I installed the mod without any error and I have no error in the forum 'error log'. As I wrote, I installed the version 'Embed_Facebook_BBCode_v3.11' and when I put it for example facebook video between facebook tags I do not get anything except empty message (see imagen):

(https://i.imgur.com/M16zV4P.png)


I want to add that I have installed the mod 'Yet Another YouTube BBCode Tag' and I do not know if this is a problem?
Title: Re: Embed Facebook BBCode
Post by: kitz on January 28, 2019, 12:20:44 PM
This is the same problem that I have and I reported it here (https://www.simplemachines.org/community/index.php?topic=538070.msg3985122#msg3985122).

QuoteNow no-one can see any embedded FB videos and unless I switch on the option to include the url, then it looks like there is an empty post.

I've tried a reinstall but still nothing is working.
The button is there fine and it will add the {facebook} {/facebook} BBcode.  Just no video displayed.

The mod has been totally broken for me since Aug 2018.    I later made a suggestion on 18th of Aug after I'd tried to look into it, and it appears to be something to do with the facebook format for video links has changed so that code in the existing mod no longer works.

Title: Re: Embed Facebook BBCode
Post by: kitz on January 28, 2019, 12:25:29 PM
PS I just noticed the post from FishingManMatt which could be relevant

I also use Ohara YouTube Embed
Title: Re: Embed Facebook BBCode
Post by: Cola-Coca on January 28, 2019, 02:08:24 PM
Quote from: kitz on January 28, 2019, 12:20:44 PM
This is the same problem that I have and I reported it here (https://www.simplemachines.org/community/index.php?topic=538070.msg3985122#msg3985122).

QuoteNow no-one can see any embedded FB videos and unless I switch on the option to include the url, then it looks like there is an empty post.

I've tried a reinstall but still nothing is working.
The button is there fine and it will add the {facebook} {/facebook} BBcode.  Just no video displayed.

The mod has been totally broken for me since Aug 2018.    I later made a suggestion on 18th of Aug after I'd tried to look into it, and it appears to be something to do with the facebook format for video links has changed so that code in the existing mod no longer works.

Thank you for explanation !!!
Can you have an older version (3.7) which worked fine for you ?
If you have it, please send me download link via PM.

Thanks  :)
Title: Re: Embed Facebook BBCode
Post by: Cola-Coca on January 29, 2019, 11:50:19 AM
Any news ?
Title: Re: Embed Facebook BBCode
Post by: Arantor on January 29, 2019, 11:58:08 AM
The author hasn't been online for a week and even if he had, it's actually unreasonable to expect someone doing this in their spare time to always respond in less than a day
Title: Re: Embed Facebook BBCode
Post by: Cola-Coca on February 10, 2019, 04:11:49 PM
bump!  :)
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on February 25, 2019, 10:29:29 PM
I apologize for having been absense for the last few months.  Life decided it wanted to rachect up the difficulty level some.... You know, computer problems, vehicle problems, work problems, etc.....

I'm looking for the cause of the issues that have been reported.....
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on February 26, 2019, 11:14:55 AM
(https://filipinobeautyqueens.files.wordpress.com/2014/06/sad-whiner-emoji.png)
Okay, I've personally gotten this mod to work on Chrome browsers, but failing miserably on FireFox browsers on my Windows 7 OS.....  I've followed Facebook's own instructions on how to embed this stuff and Firefox seems to want to snub it's nose at me....  I'm going to publish a new version, but it doesn't work on FireFox browsers (at least that I can tell)....  Gimme a little while to figure out how to make the necessary changes for it to work on Chrome.
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on February 26, 2019, 12:24:27 PM
I apologize to everybody for the enormous delay!  I'm working on the mod issues....

Okay, Firefox has a feature called "Tracking Protection".  Disabling it through about:config allows FireFox to correctly show the embedded stuff in the browser window.....  This irritating "feature" caused me much irritation while trying to figure out why FF was being a pain in my butt.  Anyways, an update is going to be out soon!

This mod is going to require some additional editing in order to bring some cool new features that almost every one of my video mods has: responsive video formats....  Sorry about the additional delay, but since the video tags have changed, it should be easy enough to add the required HTML code to make the video size responsive....

Quote from: FishingManMatt on November 19, 2018, 06:58:17 AM
Hi dougiefresh!
First of all, thank you for your mod.

Just wanted to report the same bug which Suki had made in his Ohara YouTube Embed mod.
I described the bug in this post (https://www.simplemachines.org/community/index.php?topic=462968.msg3896344#msg3896344).

In the installation script you can find the following:
<file name="$sourcedir/Post.php">
<operation>
<search position="replace"><![CDATA['<img>]]></search>
<add><![CDATA['<img><div>]]></add>
</operation>
<operation>
<search position="replace"><![CDATA['<img>]]></search>
<add><![CDATA['<img><div>]]></add>
</operation>
</file>


which results in:
<img><div><div>


Another issue worth to mention:
I think that many people use both mods Embed Facebook BBCode and Ohara YouTube Embed and both mods modify the same img tag in different manner:

Ohara YouTube Embed converts the img tag into:
<img><iframe><video><div>

Embed Facebook BBCode into:
<img><div>

Maybe there is some way to unify this code for both mods?

Best regards
Matt
It's been fixed.  Hopefully this mod won't conflict with anything else...
Title: Re: Embed Facebook BBCode
Post by: Cola-Coca on March 03, 2019, 04:41:15 PM
Quote from: dougiefresh on February 25, 2019, 10:29:29 PM
I apologize for having been absense for the last few months.  Life decided it wanted to rachect up the difficulty level some.... You know, computer problems, vehicle problems, work problems, etc.....

I'm looking for the cause of the issues that have been reported.....

Thank you very much. I hope you will quickly remove this problem.

Thank you.  :)
Title: Re: Embed Facebook BBCode
Post by: FishingManMatt on March 09, 2019, 01:20:03 PM
Once again, many thanks for your support, dougiefresh!
Title: Re: Embed Facebook BBCode
Post by: dougiefresh on May 22, 2019, 04:59:24 PM
Uploaded v3.12 - May 22nd, 2019
o Added support for SMF 2.1 RC2.
o Removed support for SMF 2.1 Beta 1.
o Updated the code for the embedded Facebook video.
o Modified installer to change <img> to <img><div> in two different places.




@Everybody:  Let me know if this version fixes the issues that were brought up.  It's been a long while since I coded anything for SMF, and I've forgotten what I did with this mod since my last coding session.  Thanks for your assistance and (hopefully) your understanding!
Title: Re: Embed Facebook BBCode
Post by: villasg on June 05, 2019, 07:06:26 AM
Thanks , just now i made the update ......
Title: Re: Embed Facebook BBCode
Post by: kitz on July 07, 2019, 03:34:15 AM
@dougiefresh

Thank you so much for attempting to fix this.  I installed this a couple of days ago and at first all seemed to be ok.   

Unfortunately I've since had to disable it after reports of the following issues.

Uninstalling the mod restores the ability to use the quote functions in both scenarios.
Title: Re: Embed Facebook BBCode
Post by: kitz on July 07, 2019, 03:35:04 AM
PS the mod also seems to be unable to accept links which are in the following format
https://www.facebook.com/watch/?v=2260263807362303 and just displays  [ Invalid Facebook URL ]
Title: Re: Embed Facebook BBCode
Post by: jsx on March 04, 2022, 06:52:22 AM
Here "Default width of embedded Facebook video" I have the video width set, but unfortunately the embedded video is smaller than the value I entered. Anyone know how to fix this?
Title: Re: Embed Facebook BBCode
Post by: landyvlad on December 20, 2022, 09:00:06 PM
Does anyone know if this mod works in SMF 2.1.3, or whether there is an alternate mod to do the same thing (embed a facebook feed from a FB page)
Title: Re: Embed Facebook BBCode
Post by: 20abc22 on December 29, 2022, 10:26:37 PM
Have successfully installed this mod, see Facebook button, but after making a post see nothing but the URL.

Please advise.

Thank you.