Plugin: YouTube in bbPress
-
First off, an example can be found here. Download the bbPress YouTube plugin! Now the disclaimer…….
This plugin will only Key Masters and Administrators to put YouTube videos into posts. Why only those two groups you might ask? Well, because this plugin right now allows ALL embeds and objects out there to be put into your forum posts and I thought this might be a bit much for the general public! This plugin was started by myself and then mdawaffe finished it off for me. Nothing special, but the next version will have the code to only only YouTube videos in an easy way, but for now you need the entire embed code from YouTube, like this:
<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/lh5316fcit0"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/lh5316fcit0" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>
If you decide to take out the conditional for adminstrators, do so at your own risk! It is nothing special, but at least will do until we can get a better version!
Enjoy!
Trent
-
I have managed to embed all kinds of things! Fun actually!
http://onvertigo.com/topic/media-types-played-in-this-forum?replies=9
Trent
So in the next version like:
<youtube>linktothevideo</youtube>
??It will be more like how wordpress.com does it:
[youtube=videolink]
Trent
Hey Trent,
How can I set this so Moderators can also post youtube videos.
Thanks,
Orion
Off the top of my head, change this line:
if (bb_current_user_can('administrate')) :
to something like this:
if (bb_current_user_can('moderate')) :
That should get it working!
Trent
Beautiful! It works, thanks.
How does that help integrate youtube into bbPress? That is just a site that now allows its members to integrate youtube into their site. I would recommend just using this one.
Trent
Testing it out here:
http://www.grindhouse.com/forums/topic/31
Will come in handy for the site as it grows. Thanks!
has anyone tried hacking this to limit the types of embeds.. say, make sure it’s only from x-tube/youtube/etc… maybe a url check?
I second nolageek’s request
Anyone have allow-youtube.zip? The link at the top is 404’ing.
Thx
i don’t think it’s just that link the entire plugin database seems to be down. but hopefully back up soon?
I use this plugin ported from a Vanilla Extension:
<?php
/*
Plugin Name: Video Tags
Plugin URI: http://lussumo.com/addons/index.php?PostBackAction=AddOn&AddOnID=33
Description: Ported from SirNot's HtmlFormatter for Vanilla
Author URI:
Version: 0.1
*/
//allow youtube and google videos to be posted, tags are:
//<video type="google">docid</video> (google video) -or-
//<video type="youtube">video id</video> (youtube) -or-
function video_embed($texto){
$sReturn = preg_replace_callback(
'/<video(?>s+)type=(["'])((?>w+))1(?>s*)>([A-Za-z-_d]+?)</video>/is’,
‘VideoLink’,
$texto
);
return $sReturn;
}
function VideoLink($Matches)
{
$Type = strtolower(trim($Matches[2]));
$ID = $Matches[3];
switch($Type)
{
case ‘google’ : return (‘<embed style=”width: 400px; height: 326px;” id=”VideoPlayback” ‘.
‘type=”application/x-shockwave-flash” src=”http://video.google.com/googleplayer.swf?docId=’.$ID.'”></embed>’);
case ‘youtube’ : return (‘<object width=”425″ height=”350″><param name=”movie” value=”http://www.youtube.com/v/’.$ID.'”></param>’.
‘<embed src=”http://www.youtube.com/v/’.$ID.'” type=”application/x-shockwave-flash” width=”425″ height=”350″></embed>’.
‘</object>’);
default : return $Matches[0];
}
}
function allow_video_tags( $tags ) {
$tags = array(‘type’ => array(‘maxlen’ => 10));
return $tags;
}
add_filter( ‘bb_allowed_tags’, ‘allow_video_tags’ );
add_filter( ‘post_text’, ‘video_embed’ );
?>
`
It allows you to embed video only from YT or Google Video.
Link doesnt work. 404 error. Anyone have the plugin somewhere else?
I managed to destroy this one and with a server crash and just haven’t rewrote it yet, but if you head over to https://bbpress.org/plugins/topic/55?replies=8 that plugin will do the same thing
Trent
Great , Thanks trent
How to change it to all user can post embed object?
If you look at the plugin, it’s pretty simple. Line 12:
if (bb_current_user_can('administrate')
If you want to allow other users to do everything that this plugin allows, you would need to change ‘administrate’ to whatever permission your users have. I am not going to post exactly how to do it, since I think it could be a potential security hole, but that line right there is the key. Take a look at the plugin and see what I mean.
The Youtube plugin isn’t available for download anymore? The webpage you posted has changed. Where can I download it?
I’d suggest using this plugin instead:
ttp://bbpress.org/plugins/topic/bbvideo/
It works for bbPress 0.9.4 (except for the plugin admin page but that’s bearable). It is easy to add other video sources and even modify the RegEx that pulls the link so that videos are embedded with their own tag – [video=the_video_url] for example.
can you set so only moderators and admin can post the you tube videos in bbpress
Maybe you can take a look at this plugin:
https://bbpress.org/plugins/topic/admin-can-post-anything/
I’m not sure if it works on current bbPress versions though.
This one works great on bbPress 1.02 Easy Video Embed for YouTube and other tube videos
- You must be logged in to reply to this topic.