How do I change a "Login" link to "Logout" if the user is signed into the website? I would like to do this for Manager and also for Web users.. for the Web users I would be using WebLoginPE if it matters
-
☆ A M B ☆
- 476 Posts
One the web user logins in via the WebLogin snippet, just use this PHx code. Obviously replace "Web User Group Name Here" with the name of whatever Web User group they belong to. Basically the PHx will detect once they login and change "Login" to "Logout". Also note I’m using document 10 here, but change that to wherever you want to redirect them to after they click on "Logout". Hope this helps.
[+phx:mo=`Web User Group Name Here`:then=`<a href="[~10~]?webloginmode=lo">Logout</a>`:else=`<a href="[~10~]">Login</a>`+]
Oh yeh, be sure install the PHx plugin...it doesn’t come default in the MODx install.
http://modxcms.com/extras/package/?package=342
Precision Web Development ... SmashStack.com
Another option to PHx is using the Personalize snippet with chunks.
...Or use the FormLogin tpl (WebLogin)
What is the output (source) if you set up these links in your template:
<a href="[~1~]">[~1~]</a><br />
<a href="[~22~]">[~22~]</a><br />
Maybe you miss alias for your document/resource 1, together with using
FURL.
-
☆ A M B ☆
- 476 Posts
it changes the link to "logout" but when i click "logout" it does nothing..
If I remember correctly, the resources (aka pages) can’t be cached where phx is being used to determine if the person is logged in or not.
Precision Web Development ... SmashStack.com