Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Autolinking from imported Vanilla 1 forum

allanjallanj
edited June 2011 in Vanilla 2.0 - 2.8
Hello,

I've just been done what is needed to upgrade my forum from Vanilla 1 to Vanilla 2 (I know a little behind the times...!). It's all looking great, but there is one thing I can't quite wrap my head around which is autolinking in old posts. Plain text URLs are linked no problem when making a new post in Vanilla 2, but I've got a mountain of old posts from Vanilla 1 with plain text URLs which I would really like to have automatically linked. Is this possible? I've searched the plug-ins and forums but most references are how to do this in Vanilla 1 - particularly since Vanilla 2 does it automatically with new posts.

Thanks,
Allan
Tagged:

Best Answer

  • ToddTodd Vanilla Staff
    edited June 2011 Answer ✓
    @allanj, Have a look at the Format field of the discussions/comments in question. If they are specified as "Text" then the links won't display. If they are specified as "Html" then they will.

    You can manually update this on your old posts and you should be fine.

Answers

  • ToddTodd Vanilla Staff
    You use routes that 301 redirect old links to their new locations. In fact, when you run the importer it will create the most common ones for you.
  • Sorry I didn't make the question quite clear - in the posts in each discussion there I have plain text links such as http:/ /google.com (without the space - just to prevent the auto linker here!). In Vanilla 1 I used the "Extended Text Formatter" extension to have it automatically converted to a link when displayed (a similar extension was "AutoLinker"). Is this possible with Vanilla 2? i.e. can text be formatted on output as well as input?

    Thanks,
    Allan
  • When you post a link in vanilla it automatically gets generated to a link:
    http://www.vanillaforums.org
    So the autolinker plugin is embedded inside vanilla 2, if you could see it that way.

    There was an error rendering this rich post.

  • lucluc ✭✭
    edited June 2011
    He agrees to that, but it's not done when displaying apparantly, as his old posts from v1 are not autolinked.
  • Yup, as luc notes, it's no problem at all with new posts, but I've got a lot of posts imported from Vanilla 1 which doesn't have links automatically marked up. It would be great if this were possible - a something like a OutputFormater, similar to the InputFormater which is currently in the config.

    I can of course see why it is done the new way - do it once rather than for every view. A nice optimisation :-). I just can't see how to do something like how it was done before for legacy posts.

    Allan
  • ToddTodd Vanilla Staff
    edited June 2011 Answer ✓
    @allanj, Have a look at the Format field of the discussions/comments in question. If they are specified as "Text" then the links won't display. If they are specified as "Html" then they will.

    You can manually update this on your old posts and you should be fine.
  • You can manually update this on your old posts and you should be fine.
    I would even do that with a MySQL query where possible.

    There was an error rendering this rich post.

  • @Todd: That did it nicely - thanks. Can you tell me where the magic piece of code which does that is? There are one or two old formatting things from my old forum that would be good to have reformatted like that as well.

    @UnderDog: 22'000 comments - yup, I'll be doing it by SQL :-)
  • ToddTodd Vanilla Staff
    edited June 2011
    There is a Gdn_Format::Links() function if that's what you're asking for. Not quite sure though.
  • 22'000 comments - yup, I'll be doing it by SQL :-)
    Figured that. It's fun to find out what you want to change though. If you change the format field, will the contents be changed to html and will everything be allright, or do you wish to change more things (interesting!). How would you do that. Updating 22'000 comments changing 1 (flag) field should be easy.
    Changing the details inside the imported comments, that's a real brain teaser.

    There was an error rendering this rich post.

  • What I've done is to add a call to "Gdn_Format::Links()" in Gdn_Format::Text (line 959 of class.format.php) which will do the automatic highlighting of the comments for the plain text comments I've got (doing it this way rather than changing the type to 'Html' to try and keep it as close as possible to the old system for the old posts - while the new ones will get markdown).

    @Todd: You probably hear it all the time, but it is quite one thing to look at the end result of a product and think "wow", but to go through the code and think the same thing is something else entirely. Vanilla is a fantastic example of how to build a product - nice one and thanks for making it available to us all!

    Regards,
    Allan
  • ToddTodd Vanilla Staff
    @allanj, believe me that it feels really good to hear you nice sentiments. We have some great people here, but I've also dealt with trolls too so hearing nice things is always, well nice.
  • @todd - I second @allanj comments. Vanilla is simply brilliant, congrats to all the team.

    I'm raising this old thread because I've got a similar question/issue. In my old Vanilla 1 forum I was using Autolinks which very cleverly turned a long URL into a hyperlinked phrase... for example: h.ttp://www.blahblahblah into [Click here] (with 'click here' obviously linking to the URL).

    Upon upgrading to Vanilla 2, all that has been lost (understandable since the extension/plugin isn't there to weave its magic), and I'm now left with the full text URLs.

    I've hunted through the Vanilla 2 plugins (no luck) and am wondering if an Autolinks-type plugin exists for Vanilla 2?

    Cheers!

  • ToddTodd Vanilla Staff
    via Email
    There's nothing like this that I can remember. I can see a case for this as a core option. I'll give it a thought.
  • Thanks for the reply @todd - much appreciated

    I too see this as being a great addition to the core functionality - particularly if the output could be tweaked by the admin

    cheers

Sign In or Register to comment.