I've got the front-end users login working on my site.
I'm using this Chunk in my page templates (in the page body)
to show if visitors are logged in or not:
[[!Personalize?
&yesChunk=`header_for_members`
&noChunk=`header_for_guests`
&ph=`name`]]
I'm using this chunk for header_for_guests:
<span id="logged_in_status" style="font-family: arial; font-size: 10pt">
You are not signed in | <a href="[[~3]]">Click Here to Sign In</a>
</span>
I'm using this chunk for header_for_members:
<span id="logged_in_status" style="font-family: arial; font-size: 10pt">
You are signed in as <strong>[[+modx.user.id:userinfo=`fullname`]]</strong> | <a href="[[~3? &service=`logout`]]">Click Here to Sign Out</a>
</span>
When I view any page in the MODx Manager, the chunks are appearing properly.
But if I go to another browser, where I am not logged into MODx Manager and am in effect "someone visiting the site," the
you are not logged in text doesn't appear.
If I log in, the
you are logged in text appears ... and then when I log back out, the
you are not logged in text is missing again.
Can you tell me what I'm doing wrong?
[ed. note: alanhorvath last edited this post 14 years, 3 months ago.]
Alan
--------------------------------------------------------
MODX Revolution 2.2.2-pl
Thanks! I will try that when I get some time ... right now, I just got Bob's book MODX: The Official Guide and I'm finding it so wonderfully understandable that I can't stop reading!
HA! How cool is that!?
I'll be back and post the results of my efforts to let you know how I've faired ... and to let you know how much I appreciate your help.
Alan
Alan
--------------------------------------------------------
MODX Revolution 2.2.2-pl
I pasted your code into the content area of one of my pages, as you said:
Logged in: [[+modx.user.id:isloggedin`]]
Not logged in: [[+modx.user.id:isnotloggedin`]]
Not logged in, I got this:
Logged in: 0 Not logged in: 0
Then after logging in, I got the same thing:
Logged in: 0 Not logged in: 0
Alan
--------------------------------------------------------
MODX Revolution 2.2.2-pl
Let's try something different. Put this on the page along with your Personalize snippet tag and see who MODX thinks you are in various situations:
<p>User NAME: [[+modx.user.username]]</p>
------------------------------------------------------------------------------------------
PLEASE, PLEASE specify the version of MODX you are using.
MODX info for everyone:
http://bobsguides.com/modx.html
Before I logged in ... and after I logged in (on another browser where I was not in the Manager) it displayed the same:
Username: (anonymous)
Alan
--------------------------------------------------------
MODX Revolution 2.2.2-pl
That's very odd. Are you using a context other than 'web' ?
------------------------------------------------------------------------------------------
PLEASE, PLEASE specify the version of MODX you are using.
MODX info for everyone:
http://bobsguides.com/modx.html
No ... context is "web."
I *did* set up the "anonymous" User Group as "web" and "Load Only" ... with 2 resource groups - "Drivers Only" and "Members Only" - also as "web" and "Load Only".
Then I have another User Group called "Drivers" with a resource group called "Drivers Only," set as "web" and "load, view" ... and I have another User Group called "Members" with a resource group called "Members Only," set as "web" and "load, view".
Does that help?
Alan
--------------------------------------------------------
MODX Revolution 2.2.2-pl
In theory, I don't think that any of that should affect a user's login status, but I suspect that it does.
You're logging in as someone who is a member of some group other than Anonymous, right?
The only thing I can suggest is to try changing the policy to Administrator for that user's group and see if it makes a difference in how Personalize responds.
------------------------------------------------------------------------------------------
PLEASE, PLEASE specify the version of MODX you are using.
MODX info for everyone:
http://bobsguides.com/modx.html
Thanks, Bob.
Yes ... I'm logging in as someone who is *not* in the Anonymous group ... in fact, "Anonymous" has no users at all.
I'm not sure I know what you mean by "changing the Policy to Administrator." I went to the Resource Group and made it "Super User - 0" ... but that did nothing; no help.
Then, I went back and updated the user group and made the Parent Group "Administrator" ... that didn't work either.
Then, when I went to put it back the way it was, I noticed the Parent Group was "0" ... so I reset it to that. Is that right?
When I log in, the Chunk for Members works. But when I log out, or whenever I'm not logged in, the Chunk for Guests does not work.
And ... when I'm viewing any page from the Manager ... both Chunks work.
[ed. note: alanhorvath last edited this post 14 years, 3 months ago.]
Alan
--------------------------------------------------------
MODX Revolution 2.2.2-pl