No announcement yet.

Stop vbulletin opening links in a new window

  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Hey thanks Cromebookuser! That worked great for my site.


    • #17
      Originally posted by ChromebookUser View Post
      I hacked vbulletin link target code to not open a new window when linking between my cms, blog, forum postings!

      In includes/class_bbcode.php I changed the last line of function handle_bbcode_url from this:

      PHP Code:
      return "<a href=\"$rightlink\" target=\"_blank\"" . ($is_external ' rel="nofollow"' '') . ">$text</a>"
      To this:

      PHP Code:
      return "<a href=\"$rightlink\" target=\"" iif(strstr($rightlink,""),"_self","_blank") . "\"" . ($is_external ' rel="nofollow"' '') . ">$text</a>"
      Note that you have to re-save your articles after making this code change.

      I also made this change in includes/class_bbcode_blog.php to function handle_bbcode_url.

      I haven't tested this a whole lot but it looks good.
      I have to give you a standing ovation. Works like a charm!

      Just a note that those who use this hack need to change the URL in the code from "" to your site's url. I know I'm being Capt Obvious here but a newbie hacker might overlook it.

      Thanks ChromebookUser!

      As for the rest of the conversation, most would agree you do not want your internal links to open in new windows. That's a horrifying experience for any user.

      As for external links, I prefer new tab/window. Sometimes when you surf, you find a good site/source but in the process of clicking links you end up reading interesting sites/articles you weren't originally searching for. After clicking into the 6th degree website and totally forgetting why you were on the internet, its nice to have that window "still open" to remind you what you were looking for in the first place.

      That's just me.


      • #18
        my special case with the external links

        i have one question i wish you can help me with it
        in the forum
        if you click on any external link ( it will use a file called outgoing.php
        here is the code:
        PHP Code:

        (E_ALL & ~E_NOTICE);


        DIR '/includes/functions_login.php');

        // input parameters
        if (isset($_GET['to']) &&
        is_scalar($_GET['to']) &&
        strlen($_GET['to']) &&
        strlen($_GET['to']) % == &&
        preg_match('/^[a-z\d]+$/i'$_GET['to'])) {
        $url $_GET['to'];
        } else {
        $url dechex(ord('/'));

        $templater vB_Template::create('REDIRECT_TO_EXTERNAL_LINK');

        the problem is that when you click on the link it takes you to:
        but it should go to:
        my question is: How can i find the place that controls the path of outgoing.php


        • #19
          See - no core file edits.
          Psychlinks Mental Health Support Forum
          Tourette Canada Support Forum
          Local Search Forum