1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Replacing old custom YOUTUBE BBcode in posts

Discussion in 'XenForo Questions and Support' started by Ingenious, Feb 15, 2012.

  1. Ingenious

    Ingenious Well-Known Member

    In my imported forum, all YouTube videos are embedded in posts using some custom BBcode, because otherwise vB just displayed a link to the video and not embed the actual video. So my forum posts are full of:


    Is there an easy way I can do a search and replace on these as follows:

    find [YOUTUBE]$string[/YOUTUBE]
    replace with

    I'm sure I read somewhere you can do a search and replace but I cannot for the life of me find this now. I can't see any options either in XenForo admin or vB admin to run a search and replace query like this.

    Any ideas please? :)
    brucey likes this.
  2. Brogan

    Brogan XenForo Moderator Staff Member

    Take a backup first.

    UPDATE xf_post SET message = REPLACE(message, '[youtube]', '[media=youtube]');
    UPDATE xf_post SET message = REPLACE(message, '[/youtube]', '[/media]');
    That will embed all videos, assuming just the video ID is between the existing youtube tags.
    Phases, brucey, Mendo and 2 others like this.
  3. Ingenious

    Ingenious Well-Known Member

    Brilliant - just tried that and it works 100% :) Many thanks!
  4. turkyalawlqy

    turkyalawlqy Active Member

    I also had the same problem
    Can I replace all the orders one?
  5. Brogan

    Brogan XenForo Moderator Staff Member

  6. EgyKit

    EgyKit Member

    This was really helpful :), there was some old custom vbulletin youtube tags didn't change using this add-on


    This was fast, accurate and save, but always remember to do backup before you play with the database!
    Jake Bunce likes this.
  7. ainwood

    ainwood New Member

    Of course, you could easily just create a custom xenforo youtube bbcode.
    <iframe width="500" height="300" src="https://www.youtube.com/embed/{text}?wmode=opaque" frameborder="0" allowfullscreen></iframe>
    Simple replacement, no parameter.

Share This Page