Stop vbulletin opening links in a new window

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Tagman
    New Member
    • Oct 2010
    • 13

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

    Comment

    • dinarmet
      New Member
      • Mar 2007
      • 12

      #17
      Originally posted by ChromebookUser
      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,"chromebookuser.com"),"_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 "chromebookuser.com" 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.

      Comment

      • samergains
        New Member
        • Jul 2011
        • 21
        • 4.1.x

        #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 (www.youtube.com) it will use a file called outgoing.php
        here is the code:
        PHP Code:
        <?php

        error_reporting
        (E_ALL & ~E_NOTICE);

        require_once(
        './global.php');

        require_once(
        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');
        $templater->register('url'$url);
        $templater->register('headinclude'$headinclude);
        $templater->register('footer'$footer);
        print_output($templater->render());

        ?>
        the problem is that when you click on the link it takes you to:
        arabic.rt.com/outgoing.php
        but it should go to:
        arabic.rt.com/forum/outgoing.php
        my question is: How can i find the place that controls the path of outgoing.php
        http://arabic.rt.com/forum

        Comment

        • djbaxter
          Senior Member
          • Aug 2006
          • 1418
          • 4.2.5

          #19
          See http://www.vbulletin.org/forum/showthread.php?t=286030 - no core file edits.
          Psychlinks Web Services Affordable Web Design & Site Management
          Specializing in Small Businesses and vBulletin/Xenforo Forums

          Comment

          widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
          Working...