odin777 Posted January 27, 2021 Report Share Posted January 27, 2021 Hi, I am using the landing page plugin as main home page, and I want to redirect users to forums instead of the index page (if they are logged in). I tried to add this code in globaltemplate before header: {{$member = \IPS\Member::loggedIn();}} {{if app == 'landingpage'}} {{header("Location: http://localhost/test.com/forums/");}} {{endif}} But nothing happened, pls any suggestions? Quote Link to comment Share on other sites More sharing options...
accop Posted January 27, 2021 Report Share Posted January 27, 2021 34 минуты назад, odin777 сказал: {{header("Location: http://localhost/test.com/forums/");}} You cannot specify a header in the template, it will already be sent before this line is executed You can easily google the redirect on JS Quote Link to comment Share on other sites More sharing options...
odin777 Posted January 27, 2021 Author Report Share Posted January 27, 2021 Thank you man, I tried Not working {{$member = \IPS\Member::loggedIn();}} {{if app == 'landingpage'}} <script> jQuery(location).attr('href', 'http://localhost/test.com/forums/'); </script> {{endif}} Not working {{$member = \IPS\Member::loggedIn();}} {{if app == 'landingpage'}} <script> function myFunction() { window.location.href("http://localhost/test.com/forums/") } </script> {{endif}} Not working Quote Link to comment Share on other sites More sharing options...
Silence Posted January 27, 2021 Report Share Posted January 27, 2021 This plugin enables IPS to redirect the user to a URL specified by referer= after login. Referer.xml Referer.xml Quote Link to comment Share on other sites More sharing options...
odin777 Posted January 27, 2021 Author Report Share Posted January 27, 2021 Thank you, but not working for Invision Community v4.5.4 (installed version) Quote Link to comment Share on other sites More sharing options...
Silence Posted January 27, 2021 Report Share Posted January 27, 2021 system/Login/Login.php /** * @brief Force a URL to send to post-login * @note Useful when you need to redirect the user to another URL that is not local to this installation */ public static $forcedRedirectUrl = NULL; /** * Fetch the URL to redirect to * * @return \IPS\Http\Url */ public static function getDestination() { /* Try and get a referrer... */ try { /* Are we forcing the user to be sent to a specific URL? */ if( static::$forcedRedirectUrl !== NULL ) { return static::$forcedRedirectUrl; } If you're dev you should know what to do Quote Link to comment Share on other sites More sharing options...
odin777 Posted January 27, 2021 Author Report Share Posted January 27, 2021 {{$member = \IPS\Member::loggedIn();}} {{if request.app == 'forums' and request.module == 'forums'}} <script> jQuery(location).attr('href','http://localhost/test.com/forums/'); </script> {{endif}} The code above working for (forums), but how to do it for landingpage plugin? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.