SimplePortal
Support => English Support => Topic started by: willerby on February 19, 2012, 05:26:53 PM
-
I have a SP page that can only be seen by a certain membergroup. An external site would like to link to that page, which is fine if the user is logged in permanently and a member of that membergroup but unfortunately creates an error message if they are not logged in.
I'd like to somehow redirect to a login that once completed linked back to the page but can't figure out the best way to do this. Any ideas?
Thanks all
W
-
Is this a php page?
I can show you how and if it is a php page then I'll show you some logic at the start of it else you need to create a second page (php).
Just inform me whether it is a php page or not & I'll show you how to do it very easily.
-
If it's a php page you can actually use some logic to put the following into it but I will assume it is not..
Let us use an example page you want people to be redirected to named my_portal_page
Create a php page that you use to direct users to and put the following into it:
ie. let's call this page toledo_window_box
global $context;
$_SESSION['site_redirect'] = 'Willerby';
if ($context['user']['is_guest'])
@redirectexit('action=login');
else
redirectexit('page=my_portal_page');
Now edit this file: Sources / LogInOut.php
find:
// Just log you back out if it's in maintenance mode and you AREN'T an admin.
replace with:
/* Redirect the user to a specific page if opted */
if ((!empty($_SESSION['site_redirect'])) && $_SESSION['site_redirect'] == 'Willerby')
{
$_SESSION['site_redirect'] = false;
redirectexit('page=my_portal_page');
}
// Just log you back out if it's in maintenance mode and you AREN'T an admin.
Now when you link the page: http://YOUR_SITE/index.php?page=toledo_window_box
If the person is not already logged in they will be directed to the login page and when they finish logging in it will redirect them to your other page.
If they are already logged in, it will just redirect them to your other page.
-
willerby -- did that work for you?