Advertisement:

Author Topic: Adding option to stop mod from displaying YouTube video's as a video  (Read 6590 times)

Offline NekoJonez

  • Full Member
  • ***
  • Posts: 501
  • Gender: Male
  • Stuff
    • @NekoJonez on Twitter
    • My blog
Okay, the title might need some explanation.

I'm using the "Simple Youtube Video Embedder/BBC" mod to render my YouTube video's as a video directly on my forum. (Sadly enough, I don't find it anymore on the mod site. Am I looking wrong?)

Anyways, some of my users have a slow connection and the loading of all those video's make it that their computer has a sort of mini heart attack.

But the users don't want the feature to go away.

Now my question is, how can I add some code where users can toggle an option that makes it that YouTube vids don't render as a video but stay as a link?

Is that possible or not?
Retro video game blogger, writer, actor, podcaster and general amazing dude.

Twitter
My Blog

Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 54,807
  • Gender: Male
    • Kindred-999 on GitHub
Well. Without looking at the mod specific code, it's hard to say...  You really would need to ask the mod author.

Also, adding a per user setting can be tricky... Since you have to store it in the database.
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

Offline br360

  • Lead Support Specialist
  • SMF Hero
  • *
  • Posts: 1,887
    • GenXcommunity

I'm using the "Simple Youtube Video Embedder/BBC" mod to render my YouTube video's as a video directly on my forum. (Sadly enough, I don't find it anymore on the mod site. Am I looking wrong?)

It looks like the person that wrote the mod had his account deleted; and all of his mods were removed from here as well.

Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 54,807
  • Gender: Male
    • Kindred-999 on GitHub
To be more specific, the individual deleted his own account. We do not typically force delete any accounts other than spammers.
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

Offline margarett

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,762
  • Gender: Male
It should be possible to change the bbc parsing so that it opts to add the iframe or not, depending on a user setting.
But that requires a new field to be added in profile. There are other similar mods around, maybe you can poke on of the authors and see what do they have to say...
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

Quote
Over 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Offline NekoJonez

  • Full Member
  • ***
  • Posts: 501
  • Gender: Male
  • Stuff
    • @NekoJonez on Twitter
    • My blog
There is this other YouTube BBC mod, better ask it to that author?
Retro video game blogger, writer, actor, podcaster and general amazing dude.

Twitter
My Blog

Offline margarett

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,762
  • Gender: Male
Just YouTube I'm not sure. But there are for sure other auto-embedders ;)

In any case, all of them (IIRC) always embed the content. What you need is a "simple" switch to either embed it not, depending on the user setting... And that's the laborious task, really :)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

Quote
Over 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Offline NekoJonez

  • Full Member
  • ***
  • Posts: 501
  • Gender: Male
  • Stuff
    • @NekoJonez on Twitter
    • My blog
So, what should I do next?

Also, the current mod I have uses tags to embed the vids. We just need to post a link and it displays like a vid. Should I change anything about that?
Retro video game blogger, writer, actor, podcaster and general amazing dude.

Twitter
My Blog

Offline Kays

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,973
  • Gender: Male
    • Kayssplace
Actually, adding to $options isn't that big a deal. And it is possible to disable a bbc tag.

However when I tested this on Suki's mod all that I got was the video id number. Which was not quite what I expected. ::)

Here's a quick test to see what will happen if the [youtube] tag is disabled with the mod you are using. In Subs.php look for:

Code: [Select]
if ($smileys === 'print')

And add the following before that

Code: [Select]
if (!empty($context['user']['is_admin']))
$disabled['youtube'] = true;

Then go and view a post with video in it. If it's now a link, then there's hope. :)

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Offline NekoJonez

  • Full Member
  • ***
  • Posts: 501
  • Gender: Male
  • Stuff
    • @NekoJonez on Twitter
    • My blog
Yes, it works perfectly. :) But now, how can I add this as an option for users?
(And if possible, if that option is check, that the Youtube url is seen as a link?)
Retro video game blogger, writer, actor, podcaster and general amazing dude.

Twitter
My Blog

Offline Kays

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,973
  • Gender: Male
    • Kayssplace
Re: Adding option to stop mod from displaying YouTube video's as a video
« Reply #10 on: May 16, 2014, 12:15:04 PM »
Cool, I just wanted to verify that you do get a link before getting you to make the code changes. :)

Now replace that code in Subs.php with the following:

Code: [Select]
// Added to allow the user the option to not embed a YouTube video
global $options;
if (!empty($options['no_embed_youtube']))
$disabled['youtube'] = true;

In Profile.template.php in your theme or the one in the default theme if there isn't one in the theme you are using. Look for:

Code: [Select]
// Choose WYSIWYG settings?

Add before that:

Code: [Select]
// Added to allow the user the option to not embed a YouTube video
echo '
<li>
<input type="hidden" name="default_options[no_embed_youtube]" value="0" />
<label for="no_embed_youtube"><input type="checkbox" name="default_options[no_embed_youtube]" id="no_embed_youtube" value="1"', !empty($context['member']['options']['no_embed_youtube']) ? ' checked="checked"' : '', ' class="input_check" /> ', $txt['no_embed_youtube'], '</label>
</li>';

Finally, add the following to Modifications.english.php before the closing ?>

Code: [Select]
$txt['no_embed_youtube'] = 'Show YouTube videos as a link.';

If not using English for your language, translate that and add it to the Modifications file for your language.

This option now can be found on the "Look and layout" area in the user's profile.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Offline NekoJonez

  • Full Member
  • ***
  • Posts: 501
  • Gender: Male
  • Stuff
    • @NekoJonez on Twitter
    • My blog
Re: Adding option to stop mod from displaying YouTube video's as a video
« Reply #11 on: May 17, 2014, 09:44:18 AM »
Thanks man :)

It works nicely.
Retro video game blogger, writer, actor, podcaster and general amazing dude.

Twitter
My Blog

Offline Kays

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,973
  • Gender: Male
    • Kayssplace
Re: Adding option to stop mod from displaying YouTube video's as a video
« Reply #12 on: May 18, 2014, 01:40:27 PM »
Great, glad to hear that. :)

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,331
    • XPtsp.com Community
Re: Adding option to stop mod from displaying YouTube video's as a video
« Reply #13 on: December 27, 2014, 07:08:44 PM »
@Kays: Thanks for the helpful information regarding how to make that mod show a link instead of a video....

I'm using the "Simple Youtube Video Embedder/BBC" mod to render my YouTube video's as a video directly on my forum. (Sadly enough, I don't find it anymore on the mod site. Am I looking wrong?)
I found the mod at GitHub, in the event anybody is interested....
NOTICE:  My website is back up!

My Free Simple Machines mods on XPtsp.com and Simple Machines Customization Site!
My mods are being uploaded and are available at GitHub as well!

Offline NekoJonez

  • Full Member
  • ***
  • Posts: 501
  • Gender: Male
  • Stuff
    • @NekoJonez on Twitter
    • My blog
Re: Adding option to stop mod from displaying YouTube video's as a video
« Reply #14 on: December 28, 2014, 06:07:54 AM »
If something like this would be included into SMF 2.1, I think you guys should add this too.
Retro video game blogger, writer, actor, podcaster and general amazing dude.

Twitter
My Blog

Offline Illori

  • Project Manager
  • SMF Master
  • *
  • Posts: 47,495
Re: Adding option to stop mod from displaying YouTube video's as a video
« Reply #15 on: December 28, 2014, 06:28:10 AM »
at this time we have no plans to add youtube support in 2.1.