Customizing SMF > Modifications and Packages

Ohara YouTube Embed

(1/29) > >>

Suki:
Link to Mod

Ohara YouTube Embed
Author: Miss All Sunday
Attention:
On install make sure to mark the "Install in Other Themes" checkbox.


Description

For SMF 2.0.x only

This mod will add a BBC tag:  [youtube][/youtube]  where you can post your youtube urls and it will be converted to a video directly in the message.

You can enable/disable the mod as well as set the widh and height for the videos, currently the mod support the following youtube urls:


--- Code: ---http://www.youtube.com/watch?v={ID}
http://www.youtube.com/watch?v={ID}&{Parameters}
http://youtu.be/{ID}
http://www.youtube.com/watch?feature=player_embedded&v=[ID]

--- End code ---

And many more valid youtube urls.

License

 * This SMF modification is subject to the Mozilla Public License Version
 * 1.1 (the "License"); you may not use this SMF modification except in compliance with
 * the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 

 
Settings

- Admin->Configuration->Modifications


Languages

-English/utf8
-Spanish_latin/utf8
-Spanish_es/utf8


Changelog

1.1 - April 19, 2013,
- Fix the http/https url issue.
- Fixed the parsing smiles after a video issue.
- Fixed the pass by reference issue.
- Updated the regex to include more valid urls.

1.0.1 - Dic 28, 2011,
-Fix the youtube redirect page error if you use the initial tag alone: [youtube]

1.0 - Sep 25, 2011,
-Initial Release

WantSome:
Hiya!

I love your mod.  Thanks! 

I tested it with great success on my test forum, and then used it on my main forum.  For some reason I've come up with a weird problem.

The first video I embedded using the tags was this one:
http://www.youtube.com/watch?v=wifH74R3yJA 

And now for some reason whenever I go to that thread, I get redirected to youtube.  That is, the topic loads for a second and then redirects to youtube.  From topic view when I click on the topic, it goes to my youtube login page.  When I click 'view the last post' from the topic view, it redirects me to youtube. 

I then thought to access the post from my posts and edit it, but viewing my posts also now directs me to youtube.  What's happening?!

Is there a way I can edit that post without being directed to youtube?  And, is there a way to prevent this from happening again?

Thanks!

(I'm using 2.0.1)

EDIT: 
I think I've fixed it. 

When I was testing it on my forum, it was as part of an announcement to my users about the 'new feature' of being able to embed youtube videos into their posts.  I used [youtube] to illustrate ('youtube' in square brackets) and for some reason this caused the entire thing to redirect everything to youtube.  Weird.

Upon trying to edit the post, the forum page loads for a few seconds before redirecting to youtube.  I used the stop button to make it stop loading, thereby preventing it from forwarding to youtube.  I saw where the prolem lay and edited the [youtube] to exclude the square brackets (except, obviously, where I needed them for the actual video), and that seems to have sorted the problem out.

Is this a bug?

Suki:
How do you used the tag?  can you copy/paste inside the code tag the exactly same code you used.

if you use the tag [youtube][/youtube]   empty then it will show a text string: Not a valid youtube URL


The only thing I see  is the string has a %s  and I should use sprintf() on it, otherwise it will show:

Not a valid youtube URL %s

WantSome:
Thanks for the answer, Suki.

Actually I don't think I explained my solution properly.

In my post, I used the correct [youtube][/youtube] tags around the video link.  But I ALSO used just the word [youtube] in the body of the post.
When I managed to view the post (before it redirected to youtube), it showed a blank box where the video should have been.  This blank box started where the [youtube] was used.

So it looked something like this:


--- Quote ---Announcement concerning [youtube] tags.  You can now use [youtube] tags to embed your youtube videos.
Like this:
[youtube]http://www.youtube.com/watch?v=wifH74R3yJA[/youtube]

--- End quote ---

The end result was something like this:


--- Quote ---Annoucnement concerning
[BIG BLANK BOX]

--- End quote ---

When I changed the [youtube] items in the first line of the first example, the big blank box disappeared, and the thread stopped redirecting to youtube, and the video showed as expected.

I hope that's clearer now.  The problem doesn't exist any longer because I took the [youtube] away in the text of my post, and only used the tags around the video link.

So, the only bug that exists now (as far as I can tell and I'm no expert) is if someone uses the exact phrase [youtube] without a link, and without closing the tag with [/youtube], the entire thread will redirect to youtube.

Suki:
Thanks for the report, I'll take a look and release a new version.

Navigation

[0] Message Index

[#] Next page

Go to full version