Hi Alex;
By default lyte hooks into the the_content filter.
Now I don’t know the first thing about BuddyPress Activity, but you can have WP YouTube Lyte active on any string by calling lyte_parse(). So supposing the activity-feed is in $useractivity, doing
$useractivity=lyte_parse($useractivity);
should transform any youtube link into a lyte player.
Hope this helps,
frank
Thread Starter
sdesign
(@sdesign-1)
Thanks,
So where should this go?
Can it be something that’s added as a filter in functions.php? If so what would the filter be?
that should really be a buddypress filter, allowing you to filter their output. assuming they have a filter called “buddypress_useractivity”, you would probably do something like;
add_filter('buddypress_useractivity','sde_useractivity_lyte',10,1);
function sde_useractivity_lyte($in) {
return lyte_parse($in);
}
have fun! π
frank
Thread Starter
sdesign
(@sdesign-1)
Hi Frank
I tried the code with various filters but it does work π
Any other thoughts?
I don’t suppose you fancy installing buddypress and trying to get your plugin to work with the activity stream do you?
Thanks,
Alex
afraid I don’t have the time to dive into buddypress & it’s API (filters) now sdesign.
but start of with a simple function that adds “&thisisatest=0” to your user activity. if you get that working, you can add the call to lyte_parse.
frank
Thread Starter
sdesign
(@sdesign-1)
This filter replaces each activity with the word test just fine, but still no joy with lyte_parse
add_filter(‘bp_get_activity_content_body’,’sde_useractivity_lyte’);
function sde_useractivity_lyte($old) {
return ‘test’;
}
and what does $old hold?
and can you try
return str_replace('youtu','metu',$out);
and copy paste result here?
frank
Thread Starter
sdesign
(@sdesign-1)
sorry I don’t really know what I’m doing to be honest. What code should I put in my functions.php?
this one;
add_filter('bp_get_activity_content_body','sde_useractivity_lyte');
function sde_useractivity_lyte($old) {
return str_replace('youtu','metu',$out);
}
Thread Starter
sdesign
(@sdesign-1)
That code makes my videos disappear and nothing appears in its place.
Maybe worth noting that it removes the entire content of the post, not just the video.
my mistake, $out should be $old;
add_filter('bp_get_activity_content_body','sde_useractivity_lyte');
function sde_useractivity_lyte($old) {
return str_replace('youtu','metu',$old);
}
Thread Starter
sdesign
(@sdesign-1)
Hi,
I tried the code and it removed just the video from the content (left the rest of the post) but it then redirected the page to the following address…
https://www.metube.com/embed/It4Gh4-9FFI?feature=oembed
It only did this the first time I loaded the page, after that it just left blank space where the video embed should be.
Thanks,
Alex
ok, now try;
add_filter('bp_get_activity_content_body','sde_useractivity_lyte');
function sde_useractivity_lyte($old) {
return lyte_parse($old);
}
Thread Starter
sdesign
(@sdesign-1)
My videos are showing but with the regular iframe