Embed iframe code into a text field or area

12 years 10 months ago #166651 by userbk
I'm trying to create a text field or a text area where a user will paste a youtube or vimeo code of a signle videoto display on the user's profile, but I believe the code they add is being rejected and stripped out.

the new embed code of both vimeo and youtube is both iframe. I had a solution where I asked the users to copy paste the video code, but many of them fail to understand it, so I really need to allow them to just paste a code into a field.

I tried to read your article about delimiter fields, but could not see the relation to what I'm trying to do.

I don't want them to create a playlist. Just copy paste a code into a field and hit update.

What must I do?

greetings,
bk

Please Log in to join the conversation.

12 years 10 months ago #166667 by nant

Please Log in to join the conversation.

12 years 10 months ago #166767 by userbk
Hey Nant,
Thanks for answering.

I read your two articles about the delimiter field.
I actually don't need to use it as I use Profile Pro which has a delimiter field type of plugin called "Magic Window". There I indeed created the following code that works:
<?php 
global $_CB_framework;
$cbUser = CBuser::getInstance( $_CB_framework->displayedUser() );
$cb_videolink1 = $cbUser->getField( "cb_videolink1" ); ?>
 
<iframe title="YouTube video player" width="607" height="370" src="http://www.youtube.com/embed/<?php echo $cb_videolink1; ?>" frameborder="0" allowfullscreen></iframe>

But I don't want to ask my users to go copy a part of a URL into a field. I want them to be able to paste the whole code, including the iframe tag into a text field/area.

So in fact I want my code to change to:
<?php 
global $_CB_framework;
$cbUser = CBuser::getInstance( $_CB_framework->displayedUser() );
$cb_videolink1 = $cbUser->getField( "cb_videolink1" ); ?>
 
<?php echo $cb_videolink1; ?>

My problem is that when they do, the text field/area strips the code. Maybe a security measure?

Please Log in to join the conversation.

12 years 10 months ago #166794 by nant
I am not familiar with CB Pro.

CB textarea fields so strip html code.
Delimiter fields do not.

You might also try a CB editor field but configure first what tags not to strip in CB configuration area.

Please Log in to join the conversation.

12 years 10 months ago #166799 by userbk
I don't mind using a delimiter field, but my users will not just have a box where they would copy paste the embed code and hit update to have the video appear on their profile. They will need to go and figure something out and that is never a very good thing.

I just want them to have a box with no editor capabilities (I cannot get rid of all the smilies, charachters control etc without affecting all the editor fields on the site.), where they could add that embed code.

If I'm mistaken, please let me know what I should do with that delimiter to make it work. I tried to show it on the edit profile section, but it doesn't appear to be an editable field.

This is a little frustrating, given the enormous strength of CB, such a simple copy paste function has no solution.

Please Log in to join the conversation.

12 years 10 months ago #166810 by nant

userbk wrote: I don't mind using a delimiter field, but my users will not just have a box where they would copy paste the embed code and hit update to have the video appear on their profile. They will need to go and figure something out and that is never a very good thing.

I just want them to have a box with no editor capabilities (I cannot get rid of all the smilies, charachters control etc without affecting all the editor fields on the site.), where they could add that embed code.

If I'm mistaken, please let me know what I should do with that delimiter to make it work. I tried to show it on the edit profile section, but it doesn't appear to be an editable field.

This is a little frustrating, given the enormous strength of CB, such a simple copy paste function has no solution.


Trying to understand - perhaps some sample URLs of users?

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.228 seconds

Facebook Twitter LinkedIn