Skip to:
Content
Pages
Categories
Search
Top
Bottom

Youtube embed in profile

  • Avatar of Carl
    Carl
    Participant

    @serafen

    Hey! thanks for a great plugin!
    I’m trying to get a set profile field to be processed by oembed so a user can embed videos straight into their profile through a profile field.
    So far all my attempts have failed.

    Found a plugin that *sorta* does what i want (bp yt feed), but it makes another profile tab and generates a list of 25 youtube video embeds through a youtube username.

    so i’m trying with oembed.
    something like this? $bp_oembed = true;
    Doesnt work, and i dont know how to define the right component for it.
    Any help would be greatly appreciated! =)

Viewing 17 replies - 1 through 17 (of 17 total)
  • Avatar of Brajesh Singh
    Brajesh Singh
    Participant

    @sbrajesh

    @serafen
    Put the following code in your bp-custom.php
    `
    add_filter(“bp_get_the_profile_field_value”,”wp_oembed_get”);
    `
    This will allow you to insert youtube urls in profile text field(any of them) and will parse it automatically.

    Avatar of Carl
    Carl
    Participant

    @serafen

    @sbrajesh
    Hey! thanks for replying here aswell! ^_^
    Brilliant, that’s really close! :)
    It disables all my other text boxes, but it atleast shows the youtube embed! maybe a way of specifying the profile field? i’ve tried playing around with the $field->data->value, $field->type, $field->id but cant seem to get the code right.
    something like
    add_filter(“bp_get_the_profile_field_value”,”wp_oembed_get” “$field->id, Youtube” );
    or
    add_filter(“bp_get_the_profile_field (Youtube)”,”wp_oembed_get” );

    Really appreciate the help, man!

    Avatar of LPH2005
    LPH2005
    Participant

    @lph2005

    Just a thought – if you look at the bp-custom.php code given by @sbrajesh then you might consider priority.

    ` `

    The default is 10 and maybe changing it can stop the problem with disabling other text boxes.

    Avatar of Brajesh Singh
    Brajesh Singh
    Participant

    @sbrajesh

    @serafen
    Well, In that case youcan make sure it parses only one field. Please note, you will need to know the xprofile field id(You can se it by poing to profile field setup->Clicking the edit button of xprofile field and checking the url in the browser bar).

    here is the modified code
    `
    add_filter(“bp_get_the_profile_field_value”,”bp_enable_yt_in_profile”,10,3);
    function bp_enable_yt_in_profile($val,$type,$key){
    $my_key=2;//change it to field id
    if($key==$my_key)
    return wp_oembed_get($val);

    return $val;
    }
    `
    Change $my_key with the id of your field

    Avatar of Carl
    Carl
    Participant

    @serafen

    That did it! wow! thank you so much,
    been a great help and my profiles are lookin friggin awesome now! :)

    Avatar of James
    James
    Participant

    @janismo

    @sbrajesh
    @serafen

    hi guys, could you please help. why this code does not work for me?
    1. activated oembed for BP;
    2. created text field;
    3. created bp-custom.php in wp-content/plugins;
    4. changed $my_key=2 to $my_key=6;
    5. embeded code from youtube to the text box;

    result – in public view of the profile I see title of the text box, but box/row is empty.

    could you write full code, which I should include in bp-custom.php??

    help please…

    Avatar of Carl
    Carl
    Participant

    @serafen

    @janismo
    did u use youtube embed codes in the textbox? it works only with direct links like this, http://www.youtube.com/watch?v=nxtJoGdujYo

    heres my bp-custom.php
    http://dump.no/files/578bc7dce723/bp-custom.rar

    lastly, and im not sure about this, but i think u might have to install bp yt feed plugin from Brajesh.
    The piece of code does look like it calls up functions from it.

    Ive installed both oembed and bt yt feed. disabled yt feed tho, but the files are still there. Dont know 100% if it matters, but definitely worth a shot!

    Avatar of James
    James
    Participant

    @janismo

    @serafen

    thanks man!!
    with direct link works well and separate plugin for yt feed is not necessary, just oembed.

    thanks again!!

    Avatar of Brajesh Singh
    Brajesh Singh
    Participant

    @sbrajesh

    @jaisimo,@serafen
    For the profile field to show the youtube you do not need any plugin(neither my yt feed, nor the bp oembed), It works just with wordpress 3.0 inbuilt functions if you used above code.

    Avatar of Carl
    Carl
    Participant

    @serafen

    Gotcha! :)

    Avatar of r-a-y
    r-a-y
    Moderator

    @r-a-y

    The technique by @sbrajesh will work, but it will not cache the oEmbed request.

    What this means is every time you load someone’s profile page, a request will be sent to YouTube et al. to grab the embed code. This isn’t ideal if you have a high trafficked site.

    The 0.6-beta offers support for caching:
    http://buddypress.org/community/groups/oembed-for-buddypress/forum/topic/oembed-for-bp-0-6-beta-available/

    You’ll need to add the following line to wp-config.php when using the 0.6-beta:
    `define( ‘BP_OEMBED_DISABLE_XPROFILE’, false );`

    * I should note that this enables oEmbed for all xprofile fields, so if you want to have oEmbed on specific fields only, stick to Brajesh’s code in the meantime.

    Avatar of James
    James
    Participant

    @janismo

    hi,
    @r-a-y

    do you mean that this will enable oEmbed for all xprofile fields, or for all fields of particular xprofile group?

    thanks.

    Avatar of r-a-y
    r-a-y
    Moderator

    @r-a-y

    It will enable oEmbed on all xprofile fields at the moment. So if you need to target specific xprofile fields, use Brajesh’s technique for now.

    Avatar of ultimateuser
    ultimateuser
    Participant

    @ultimateuser

    This really helped me. What I am trying to do is give members the possibility to upload a ‘logo’ of their company on their profile page. I’ve got the Youtube video working, but is it possible to link to a logo (for example a .jpeg file on a website)?
    Hope someone can help!

    How do you want users to submit their logos? Upload an image or supply a link to an external site? If the latter, where do you want the user to input the link? On a separate page, or on their user profile?

    Avatar of ultimateuser
    ultimateuser
    Participant

    @ultimateuser

    @DJPaul The logo should go on their profile page. Preferraby by uploading their own image (not the Avatar though). As I couldn’t find a plugin for this I thought the above could be a solution by putting a link in a profile field to an image on their website. Hope you can help!

    Avatar of ultimateuser
    ultimateuser
    Participant

    @ultimateuser

    @DJPaul

    Any suggestions?

Viewing 17 replies - 1 through 17 (of 17 total)

You must be logged in to reply to this topic.