vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.8 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=235)
-   -   Mini Mods - YouTube URL Converter/Fix by BOP5 (replaces youtu.be with youtube.com) (https://vborg.vbsupport.ru/showthread.php?t=267450)

cstreater 11-07-2011 08:03 PM

OMG thank you! The mods you've created for our forum are definitely appreciated. Youtu.be links have definitely been a pain in my side.

The other guys I work with also love your PHP script listing all the forums & ID's. Due to the size of Android, and the number of devices they keep churning out, we have way more than I'd like to admit. Anyway, that's a little off topic from this thread. Bottom line is, thanks.

BirdOPrey5 11-07-2011 08:23 PM

You are welcome. :)

Max Taxable 11-11-2011 03:50 PM

Hey BOP5, this modification does not work in private messages, just so's ya know. Perhaps it needs a different hook location besides "postdata_presave" ??

BirdOPrey5 11-12-2011 09:50 AM

That is true, and yes it would need a different hook- will have to investigate.

BirdOPrey5 11-12-2011 10:15 AM

If anyone wants this to work on PMs- go to your Admin CP -> Plugin Manager -> Add New Plugin

product: YouTube URL Converter by BOP5

hook: private_insertpm_process

title: YouTube Fix - PMs

Exec. Order: 5

Set the php code to:
PHP Code:

if (strpos($pm['message'], "youtu.be"))
{  
  
$find "#youtu\.be/([\w-]+)#";
  
$replace "www.youtube.com/watch?v=$1";
  
$pm['message'] = preg_replace($find$replace$pm['message']);


Set ACTIVE to YES and hit "Save"
This will do the conversion in PMs too. I didn't make it an update because not everyone may want to do it with PMs. One day if I add options to this product I can make it something you may enable or disable.

Max Taxable 11-12-2011 01:53 PM

Quote:

Originally Posted by BirdOPrey5 (Post 2267235)
This will do the conversion in PMs too. I didn't make it an update because not everyone may want to do it with PMs. One day if I add options to this product I can make it something you may enable or disable.

We can disable it in plugin manager.

Thanks for this, some of my people like to send videos via the PM system and if they used that "short" URL my embed plugin wouldn't work in PM either, they would get only the live link.

This fixes that issue nicely.

mykkal 06-14-2012 06:47 AM

Anyway to get it to convert old posts? I've got a few thousand of them :)

BirdOPrey5 06-14-2012 10:40 AM

Unfortunately no.

Not sure how much work you're willing to do but if you install impex, there is a tool that comes with it called cleaner.php that will let you run a regex on all posts in your database. You could take the regex from the plugin in use it in cleaner.php to convert old posts.

Max Taxable 06-14-2012 12:06 PM

Cleaner is a dangerous tool though.

BirdOPrey5 06-14-2012 12:10 PM

It is- I would advise to make a full database backup before anyone actually uses it.


All times are GMT. The time now is 05:42 AM.

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.01782 seconds
  • Memory Usage 1,738KB
  • 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
  • (1)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)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