Posted 27 января, 20213 yr comment_167297 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?
27 января, 20213 yr comment_167299 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
27 января, 20213 yr Author comment_167300 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
27 января, 20213 yr comment_167307 This plugin enables IPS to redirect the user to a URL specified by referer= after login. Referer.xml Referer.xml
27 января, 20213 yr Author comment_167314 Thank you, but not working for Invision Community v4.5.4 (installed version)
27 января, 20213 yr comment_167315 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
27 января, 20213 yr Author comment_167316 {{$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?
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.