Thanks for this modification. It works perfect for me.
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
-
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!
Fast VPS Host for vBulletin:
A2 Hosting & IONOS
- Top
- Translate
- Bottom
Comment
-
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!
Fast VPS Host for vBulletin:
A2 Hosting & IONOS
- Top
- Translate
- Bottom
Comment
-
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
- Top
- Translate
- Bottom
Comment
-
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($rightlink, PHP_URL_HOST);
$forum_baseurl = vB::getDatastore()->getOption('frontendurl');
$forum_host = parse_url($forum_baseurl, PHP_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>";
}
- Top
- Translate
- Bottom
Comment
-
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
- Top
- Translate
- Bottom
Comment
-
Any update to make this Mod works
could any body compile this help topic from vbulletin forum into readable instructions
- Top
- Translate
- Bottom
Comment
-
Try replacing the 2 instances of the return statements into:
PHP Code:$myhtml = "the html string here";
Helpful? Donate. Thanks!
Fast VPS Host for vBulletin:
A2 Hosting & IONOS
- Top
- Translate
- Bottom
Comment
-
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!
Fast VPS Host for vBulletin:
A2 Hosting & IONOS
- Top
- Translate
- Bottom
Comment
-
Originally posted by glennrocksvb View PostI 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.
- Top
- Translate
- Bottom
Comment
Users Viewing This Page
Collapse
There is 1 user viewing this forum topic.
- Guest
Latest Posts
Collapse
-
by rdanI have multiple vBulletin 3 and 4 Licenses available for sale...
vBulletin 3.x
For the vBulletin 3.x Forum Licenses, some are standalone...Yesterday, 08:30 PM -
by MitchOn the unread, is there a way to have this option listed?
https://www.vintagefordforum.com/unread...Yesterday, 04:24 PM
Comment