vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   If URL [SUCH SUCH ] , then change to URL [SUCH SUCH] (https://vborg.vbsupport.ru/showthread.php?t=266493)

Desi-Home 07-08-2011 06:47 PM

If URL [SUCH SUCH ] , then change to URL [SUCH SUCH]
 
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

Quote:

Originally Posted by borbole (Post 2218324)
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

PHP Code:

$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 [DATE]1310268619[/DATE] at [TIME]1310268619[/TIME] ---------------

Quote:

Originally Posted by aayushagrawal90 (Post 2218626)
Create a New Plugin

Plugin Hook: postbit_display_complete

Add these codes

PHP Code:

$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

PHP Code:

$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

1 Attachment(s)
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

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

Quote:

Originally Posted by aayushagrawal90 (Post 2218758)
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

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


All times are GMT. The time now is 01:01 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01208 seconds
  • Memory Usage 1,747KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (3)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete