Jump to content

Featured Replies

Posted
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?

comment_167299
34 минуты назад, odin777 сказал:

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

  • 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

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

  • 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.


Guest
Reply to this topic...

Recently Browsing 0

  • No registered users viewing this page.