Jump to content

Another home page for logged in users


odin777

Recommended Posts

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

{{$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?

Link to comment
Share on other sites

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

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Ваша ссылка была автоматически строена.   Отображать как обычную ссылку

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...