View Full Version : If URL [SUCH SUCH ] , then change to URL [SUCH SUCH]
Desi-Home
07-08-2011, 06:47 PM
Hello,
I hope you guys understand what I'm looking for.. I'm looking for a mod which will change a URL to another URL if posted . let say if a user posts a youtube URL like
http://www.youtube.com/watch?v=PB5YQpCpY7M
I've a script which should change the youtube URL to my website URL automatically
http://mydesi.tv/youtube.php?id=PB5YQpCpY7M
I really need this mod.. help pleaseeee
vBulleting already has a feature that's a little bit like this.. like Censopship ? I tried that but that didn't work it puts so many mydesi.tv instead of one youtube.com
Any help would be really appreciated.. it's a script like .. i
<if youtube.com
then, change to mydesi.tv> something like that , i don't know coding :(
borbole
07-08-2011, 08:25 PM
You have posted your request in the wrong forum. This is a mod release forum.
TheLastSuperman
07-08-2011, 08:26 PM
You have posted your request in the wrong forum. This is a mod release forum.
Just moved it lol, your timing is impeccable :cool:.
Badshah93
07-09-2011, 07:55 PM
Create a New Plugin
Plugin Hook: postbit_display_complete
Add these codes
$post['message'] = preg_replace('/http:\/\/(.*?)youtube.com\/watch\?v\=/', 'http://mydesi.tv/youtube.php?id=', $post['message']);
Desi-Home
07-10-2011, 02:29 AM
Hey I tried that , It didn't work..
http://img17.imageshack.us/img17/6350/postreplace.png
--------------- Added 1310268619 at 1310268619 ---------------
Create a New Plugin
Plugin Hook: postbit_display_complete
Add these codes
$post['message'] = preg_replace('/http:\/\/(.*?)youtube.com\/watch\?v\=/', 'http://mydesi.tv/youtube.php?id=', $post['message']);
Hey I tried that , It didn't work..
http://img17.imageshack.us/img17/6350/postreplace.png
LifesGreatestGift
07-10-2011, 02:55 AM
try this
$this->post['message'] =
str_replace('youtube.com/watch?v=', 'mydesi.tv/youtube.php?id=', $this->post['message']);
Desi-Home
07-10-2011, 03:08 AM
I get the following error when I hit save or save an reload
Fatal error: Using $this when not in object context in /home/mydesitv/public_html/includes/adminfunctions_template.php(3717) : eval()'d code on line 1
BTW I`m saving this under the current style , not the default vB style
LifesGreatestGift
07-10-2011, 03:14 AM
no, don't use a template, put the code in a new plugin. It won't save as a template due to the synthax. See image.
Badshah93
07-10-2011, 03:42 AM
Mate, I gave u code after testing.
You need to create plugin to make it work
Plugin Hook: postbit_display_complete
Product: Vbulletin
Title: Video Domain Changer
Code
$post['message'] = preg_replace('/http:\/\/(.*?)youtube.com\/watch\?v\=/', 'http://mydesi.tv/youtube.php?id=', $post['message']);
Desi-Home
07-10-2011, 12:53 PM
Mate, I gave u code after testing.
You need to create plugin to make it work
Plugin Hook: postbit_display_complete
Product: Vbulletin
Title: Video Domain Changer
Code
$post['message'] = preg_replace('/http:\/\/(.*?)youtube.com\/watch\?v\=/', 'http://mydesi.tv/youtube.php?id=', $post['message']);
Hey I'm not sure what you mean by create plugin.. I don't know how to do that , what I did was went to Styles , and in my current style I selected create a new template , and I named it postbit_display_complete , and put that code in the body.. Is that how I'm suppose to do ? here's the pictures how I did it..
http://img17.imageshack.us/img17/6350/postreplace.png
If not please tell me how to create a plugin.. can you create one for me with that code and send so I can just import plugin and products ? thanks , really appreciate all the replies
Badshah93
07-10-2011, 01:12 PM
Upload The Plugin in Download/Upload Plugins In Admincp
Desi-Home
07-10-2011, 01:37 PM
Upload The Plugin in Download/Upload Plugins In Admincp
Thanks so much now I know where to add the plugins.. that worked like a charm.. I need a little more help , actually the tv shows I get from another site are posted like this
http://h-q.tv/go/dm.php?id=xjowsg which should change to http://mydesi.tv/dm.php?url=xjowsg
I tried playing around with that code to see if it works by replacing youtube code etc.. but it gives me error.. can you help me me please ?
As well I see the following error on top of the page in threads when I replace your code with http://h-q.tv/go/dm.php?id
Parse error: syntax error, unexpected ']' in /home/mydesitv/public_html/includes/class_postbit.php(288) : eval()'d code on line 14
Badshah93
07-10-2011, 04:01 PM
Thanks so much now I know where to add the plugins.. that worked like a charm.. I need a little more help , actually the tv shows I get from another site are posted like this
http://h-q.tv/go/dm.php?id=xjowsg which should change to http://mydesi.tv/dm.php?url=xjowsg
I tried playing around with that code to see if it works by replacing youtube code etc.. but it gives me error.. can you help me me please ?
As well I see the following error on top of the page in threads when I replace your code with http://h-q.tv/go/dm.php?id
Parse error: syntax error, unexpected ']' in /home/mydesitv/public_html/includes/class_postbit.php(288) : eval()'d code on line 14
hmm, preg_replace will be hard for you if u don't know anything about it.
use this str_replace as suggested by TheWindows7Site
You can try this code
$post['message'] =
str_replace('h-q.tv/go/dm.php?id', 'mydesi.tv/dm.php?url', $post['message']);
Desi-Home
07-10-2011, 04:51 PM
hmm, preg_replace will be hard for you if u don't know anything about it.
use this str_replace as suggested by TheWindows7Site
You can try this code
$post['message'] =
str_replace('h-q.tv/go/dm.php?id', 'mydesi.tv/dm.php?url', $post['message']);
Thanks a lot , that worked.. Hey... do you know how to show like 2, 3 , or 4 threads on forumhome home from each forum instead of showing latest 1 thread.. like this
https://vborg.vbsupport.ru/attachment.php?attachmentid=130856&d=1310268699
you see i've extra space so i want to show like 4 lates threads instead of just 1...
christon26
07-12-2011, 08:16 PM
Thanks a lot , that worked.. Hey... do you know how to show like 2, 3 , or 4 threads on forumhome home from each forum instead of showing latest 1 thread.. like this
https://vborg.vbsupport.ru/attachment.php?attachmentid=130856&d=1310268699
you see i've extra space so i want to show like 4 lates threads instead of just 1...
Like this?
https://vborg.vbsupport.ru/showthread.php?t=201300
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.