Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: oEmbed in BP Profile Field

@myg0t

Participant

Hmm, yes I did.

Just to clarify, it should be fine putting this in my functions.php, right?

This is what I have:

// Enable oembed  in profile
function bp_youtube_in_profile() {
  add_filter( 'bp_get_the_profile_field_value', 'bp_enable_youtube_in_profile', 9, 3 );
}
add_action( 'bp_init', 'bp_youtube_in_profile', 0 );

function bp_enable_youtube_in_profile( $val, $type, $key ) {

	$field = new BP_XProfile_Field( $key );
	$field_name = $field->name;

	$val = strip_tags( $val );
	
	if(  strtolower( $field_name ) == 'Spotlight Video' ) {
		return wp_oembed_get( $val, array('width'=>300) );	
	}
		return $val;
}

I assume spaces in the field name aren’t an issue right?

thanks,

\M

Skip to toolbar