Hi all.
I have my first Modx site up and running (locally) and all is great.
What I can’t seem to figure out is how to set up a link to a user’s login home page. I have multiple users and each has a different homepage post-login.
I set the document ID for the login homepage for each user but would like to dynamically display a link to that page if the user is logged in. That way they can navigate back there from any page once logged in.
I have found ways to set up a login/logout link but nothing to retrieve the document ID for the login home page.
Any help is hugely appreciated.
-shane
-
☆ A M B ☆
- 24,524 Posts
You can get it with a snippet from the SESSION; it’s in $_SESSION[’webUsrConfigSet’][’login_home’]
<?php
if(isset($_SESSION['webUsrConfigSet']['login_home'])) {
$output = '<a href="' . $modx->makeURL($_SESSION['webUsrConfigSet']['login_home']) . '">Your Home Page</a>';
return $output;
}
return;
?>
You can see it in action if you go to
http://www.sottwell.com/article-sessions.html and log in at the bottom of the page as test - testing (yes, I need to style that form better one of these days). You’ll be sent to the "now you see me" page; return to the Sessions article and scroll to the bottom, and under the Logout link you’ll see the link to "your home page".
Thanks Susan!
Is there a place to view documentation on the session variable?