Announcement

Collapse
No announcement yet.

How to change external links to internal links to do something before redirecting to the destination

Collapse
This is a sticky topic.
X
X
Collapse
First Prev Next Last
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #31
    Thanks for this modification. It works perfect for me.

    Comment


      #32
      I just re-applied this mod after upgrading to V5.5.3 but it doesn't seem to work any longer ?

      Comment


        #33
        is this compatible with php 7.3.7 ?

        Comment


          #34
          Theoretically it should be compatible as there's nothing special being done that would break in future PHP versions. But I'd have to check to verify.
          Helpful? Donate. Thanks!
          Buy me a coffeePayPal QR Code
          Fast VPS Host for vBulletin:
          A2 Hosting & IONOS

          Comment


            #35
            I updated the code in the first post. Could you try again?

            There's a bug in vB where backslash "\" in posts are stripped off. The code has "\" that were stripped off which would cause syntax error. This could explain why the mod stopped working.

            I found a workaround to prevent a backlash from being removed from posts by using double backslashes.
            Helpful? Donate. Thanks!
            Buy me a coffeePayPal QR Code
            Fast VPS Host for vBulletin:
            A2 Hosting & IONOS

            Comment


              #36
              hi thanks for the mod however I noticed some issues, it will be grateful if you can help me with

              once applying the above the forum base links is redirecting to invalid link please see the attached screenshots

              it is directing to
              /vb/$rightlink

              instead of
              /vb/node/224397

              also I have file upload script in the same domain of my forum the same issue noticed with the links added to my forum

              it is directing to
              /vb/$rightlink

              instead of
              /up/do.php?id=1501


              Attached Files

              Comment


                #37
                I used the same method you described, however I discovered the issue in the code the below code with small adjustment worked for me perfectly

                PHP Code:
                $rightlink_host parse_url($rightlinkPHP_URL_HOST);
                $forum_baseurl vB::getDatastore()->getOption('frontendurl');
                $forum_host parse_url($forum_baseurlPHP_URL_HOST);        

                // if same host, then use the link directly
                if (vB5_String::stripos($rightlink_host$forum_host) !== false) {
                    return 
                "<a href="$rightlink" target="_blank"" . ($is_external ' rel="nofollow"' '') . ">$text</a>";  
                }
                else { 
                // link to your redirect page and pass the encoded external link

                    // specify path of the redirect URL (exclude forum base url) including the querystring parameter name
                    // this is the path you used when you created the redirect page in Sitebuilder
                    
                $redirect_path "/redirect?url=";

                    return 
                '<a href="' $forum_baseurl $redirect_path urlencode($rightlink) . '" target="_blank"' . ($is_external ' rel="nofollow"' '') . ">$text</a>";

                thanks alot

                Comment


                  #38
                  Hi

                  it seams it is not working for in RSS feeds, is their any way to enable it there also ?

                  Comment


                    #39
                    all PHP modules stopped by design after the latest security update

                    The PHP module will no longer work after applying the latest security patch. This is by design. This redirect would have to be reworked using a custom API extension or Javascript. See: https://forum.vbulletin.com/articles...php-in-modules

                    Comment


                      #40
                      Any update to make this Mod works

                      Comment


                        #41
                        Any update to make this Mod works


                        ​could any body compile this help topic from vbulletin forum into readable instructions

                        &amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;p&amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;We've created a new package that is intended to facilitate the replacement of custom PHP modules with custom Display Template

                        Comment


                          #42
                          Try replacing the 2 instances of the return statements into:

                          PHP Code:
                          $myhtml "the html string here"
                          Helpful? Donate. Thanks!
                          Buy me a coffeePayPal QR Code
                          Fast VPS Host for vBulletin:
                          A2 Hosting & IONOS

                          Comment


                            #43
                            Originally posted by glennrocksvb View Post
                            Try replacing the 2 instances of the return statements into:

                            PHP Code:
                            $myhtml "the html string here"
                            thanks for reply , could you please provide more explanation what is exactly to be changed in the original PHP code ?

                            Comment


                              #44
                              I don't have access to a computer right now to try it myself but try replacing return with $myhtml =. Then follow the rest of the instructions in that article.
                              Helpful? Donate. Thanks!
                              Buy me a coffeePayPal QR Code
                              Fast VPS Host for vBulletin:
                              A2 Hosting & IONOS

                              Comment


                              • glennrocksvb
                                glennrocksvb commented
                                Editing a comment
                                I'm referring to the PHP code you posted in post #37

                              #45
                              Originally posted by glennrocksvb View Post
                              I don't have access to a computer right now to try it myself but try replacing return with $myhtml =. Then follow the rest of the instructions in that article.
                              tried doing that but I got error with the all the forum see attached , just to confirm what to do with PHP module ? it is not existed any more I placed the code from the article in HTML module is that correct ?
                              Attached Files

                              Comment

                              Users Viewing This Page

                              Collapse

                              There is 1 user viewing this forum topic.

                              • Guest Guest

                              Latest Posts

                              Collapse

                              Working...
                              X
                              Searching...Please wait.
                              An unexpected error was returned: 'Your submission could not be processed because you have logged in since the previous page was loaded.

                              Please push the back button and reload the previous window.'
                              An unexpected error was returned: 'Your submission could not be processed because the token has expired.

                              Please push the back button and reload the previous window.'
                              An internal error has occurred and the module cannot be displayed.
                              There are no results that meet this criteria.
                              Search Result for "|||"