1. There is a bug in the current version that prevents the -redirect flag from being recognized. Download a fixed version of AuthenticationTool.php at http://framework.weblite.ca/development/issue-tracker/20 and install it.
2. add the following to the beginning of your application's index.php file:
- Code: Select all
if ( @$_REQUEST['-action'] == 'login' ){
$_GET['-redirect'] = 'index.php?-action=custom_login_redirect';
$_REQUEST['-redirect'] = $_GET['-redirect'];
}
What this does is set the -redirect flag when the user logs in so that he will be forwarded to a specific URL.
-action=custom_login_redirect specifies that the user should be sent to a custom action named login_redirect. Next you will create this action.
Create a folder in your application's directory named "pages".
Add a file in this folder named "login_redirect.php"
This file will be executed when the url index.php?-action=custom_login_redirect is requested.
in the login_redirect.php file, add the following:
- Code: Select all
$authTool =& Dataface_AuthenticationTool::getInstance();
$user =& $authTool->getLoggedInUser(); // gets the currently logged in user.
if ( !isset($user) ) trigger_error("No user is logged in", E_USER_ERROR);
header('Location: '.$user->getURL());
exit;
?>
What this does, is obtains the currently logged in user, and forwards to his user record. You could use this action to redirect anywhere you like.
Hope this helps.
Best regards
Steve