PDA

View Full Version : New Posting Features - Youtube display link parser without bbcode


heavy1
04-06-2007, 10:00 PM
This is code that will parse all youtube video links and on the fly show embeded video to user.

Demo is here:

http://www.scepter.pl/showthread.php?t=582

Source of this post is:

Super komedia, film akcji, troche romansu.
Dwie pierwsze czesci byly tez fajne ale ta chyba najlepsza.

http://www.youtube.com/watch?v=QSTuPnNcI_I

As you see user don't have to use any bb tags for it to work - just paste link to post - that's it.

Thanks to TrekkerOfFiles for code deleting http://youtube.com url - I added deleting it with www. to this and it is perfect now.

It will not work very good if you have wysiwyg edit mode enabled (it breaks the link if you edit it) Using standard editor is recommended.

Mod instruction:
Updated installation info 07-04-2007:
Updated deleting http://*youtube.com 08-04-2007:

Atached zipped file cause this forum was messing up the code of modification.
It goes to /includes/ dir.

If you have other version of vb than 3.6.5 I recommend you to find jill edited code in my file and copy paste it to your file. It will work on 3.6.4 also.

If anyone can help with making it better please do :)

AzaDiyaR
04-07-2007, 12:07 PM
this not working for me

vbulletin 3.6.4

heavy1
04-07-2007, 12:10 PM
Pm me will see if i can help. Works fine on my 3.6.5.

//edit
there is something wrong with this forum - it is messing up the code.
i will add modified file in a sec.

It is now attached. Remember it is file from 3.6.5 - if you have other version installed just find my edited code inside and copy to your file.

machethier
04-07-2007, 12:22 PM
Don't Work

heavy1
04-07-2007, 12:24 PM
Try to make mew post as your vb may show you cached content of your old post.
If it still is not working pm me and we will see why.

AzaDiyaR
04-07-2007, 01:41 PM
waowwwwwwwwww thanks man :D this working now

Qwest
04-07-2007, 10:38 PM
You need to write this as a plugin or warn people that they are overwriting a core vbulletin class file!

heavy1
04-07-2007, 11:14 PM
You need to write this as a plugin or warn people that they are overwriting a core vbulletin class file!

Code changes - says it all.

Qwest
04-07-2007, 11:28 PM
It's not working in my vb 3.6.4

I uploaded it to the includes directory 20 minutes ago then posted this: http://www.agnosticforums.com/general-religion/591-what-do-you-think-video-child-abuse-freedom-speech-new-post.html

Been refreshing for 10 minutes

heavy1
04-07-2007, 11:36 PM
1. this file is from 3.6.5 so using it on other may not work.
2. just copy the code from this file to your orginal file - the code is marked by jill youtube parser
3. if you still need help pm me and i will try to help you.
4. it is possible that other modification that you may have installed is blocking it

//edit
bb class file is same on 3.6.5 and 3.6.4 - so it must be something else interfering - probably other mod you have installed..

Qwest
04-07-2007, 11:59 PM
I don't have any mods installed on this forum that deal with BBcode.

heavy1
04-08-2007, 12:03 AM
are you sure you replaced your old file with mine?
try to delete it first then upload mine.

menababu
04-08-2007, 04:49 AM
Thanks workig good on v3.6.5

TrekkerOfFiles
04-08-2007, 10:22 AM
Instead of posting the entire php file like you have done which I would suggest is the cause of most people's problems you should have done instructions in the following vain;

Open your /includes/class_bbcode.php

Find: <the code to find>

Add below: <your new code>

You're done!

If you did it this way then nobody would be overwriting this file which is bad practice to have people do IMO.

heavy1
04-08-2007, 10:27 AM
Instead of posting the entire php file like you have done which I would suggest is the cause of most people's problems you should have done instructions in the following vain;



If you did it this way then nobody would be overwriting this file which is bad practice to have people do IMO.

it was like that in begining but this forum was breaking the code eaven inside code tags.

TrekkerOfFiles
04-08-2007, 10:39 AM
Did a few changes to your code that removes the http://www.youtube.com/ bit;
Here is an example of this working: http://www.y-helo-thar.com/showpost.php?p=17098&postcount=7


Open /includes/class_bbcode.php

Find:
// ********************* PARSE BBCODE TAGS ***************************

Add Above:

//jill add youtube code remove full URL
if ( strpos($text, 'http://www.youtube.com/watch') !== false )
{
//$data = preg_replace("http*youtube*com","", $data);
$text = preg_replace("/http:\/\/www\.youtube\.com\/watch\\?v=([0-9a-zA-Z[:punct:]]{11}+)/","[/url]<object width=\"426\" height=\"350\"><param name=\"movie\" value=\"http://www.youtube.com/v/$1\"></param><param name=\"wmode\" value=\"transparent\"></param><embed src=\"http://www.youtube.com/v/$1\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"425\" height=\"350\"></embed></object>[url]", $text);
}
//jill code end

heavy1
04-08-2007, 11:09 AM
very nice i will test it and update the code in file

thx

//edit
1 problem- www. link version is not included
I tried to replace www. with . but it doesnt work. why the dot is not working i have no idea

//edit2
resolved that problem - now working with www and without.

DJ XtAzY
04-08-2007, 08:50 PM
i thought u cant upload vb files here

Mr Chad
04-11-2007, 04:23 AM
i thought u cant upload vb files here
He could of just made a plugin. under the bbcode_parse_start hook. *HINT*

remember the people that are at this site are mostly dense and do not know how to code... So just make it as easy as possible for them.

DaReD3ViL
04-11-2007, 04:45 AM
Can this be made for the following sites (many people use them):
Dailymotion.com
veoh.com
1dawg.com
stage6.divx.com (might be trickyer, but the extreamly high quality videos are definately worth it)

Thank you

Mr Chad
04-11-2007, 04:54 AM
Can this be made for the following sites (many people use them):
Dailymotion.com
veoh.com
1dawg.com
stage6.divx.com (might be trickyer, but the extreamly high quality videos are definately worth it)

Thank you
yes it can but theres a problem if you edit your post it will re-do the changes. you need to make it make a unique change that it will check for on edits.

heavy1
04-11-2007, 08:48 AM
He could of just made a plugin. under the bbcode_parse_start hook. *HINT*

remember the people that are at this site are mostly dense and do not know how to code... So just make it as easy as possible for them.

I dont know how plugins work in vb yet.
If i will find out i will do it :P

samsee
04-11-2007, 08:56 AM
does tis mod wk fine frens ?

heavy1
04-11-2007, 09:10 AM
it is not possible to do as plugin - as plugin hook is before checking if html is allowed.
if you have html disabled in posts it will change html youtube code to normal text.

i added request for hook - if they will add it in next version then ill make plugin for it.

TGR
04-11-2007, 09:47 AM
Great mod worked fine on my 3.6.4

schlottkej
04-11-2007, 10:35 PM
...nevermind.. lol

robhole
07-23-2008, 03:35 PM
works great on vBulletin 3.7.2... only thing is when people go to edit their posts, it does not show the link anymore. Other than that, everything works perfect!!