That filter only returns true or false.
Cackhanded way of doing what you want, hopefully someone will point out a better way:
[[+modx.user.id:lt=`1`:then=`[[$chunkName]]`]]
ie if the user is anonymous they will have an effective id of 0.
Writer > E-consultant > MODx developer || Salesforce || modx 2.x || PHP 5.2.13 || MySQL client 5.0.86
You can also install the Personalize snippet through Package Manager, which will let you show one chunk to logged in users and another (possibly empty) chunk to anonymous users.
Thanks for the quick responses, odeclas and BobRay.
I prefer odeclas’ suggestion as what I’d like to achieve is to hide the Google Analytics script, if a logged in user (aka an editor) looks at the site.
Although the code seems reasonable to me and also perfectly in line with the documentation I haven’t been able to get any output from [[+modx.user.id]], no matter if used in the template or within a chunk. I thought the times of web and manager users are gone with Revo?
And to stick somewhat to the topic: what’s then a practical use of ’:isnotloggedin’?
- David.
Are you previewing from the Manager? That can throw things off. I think the user ID is 0 in that case.
Is the front-end user logged in to the current context (e.g., ’web’)?
I generally try to avoid using the conditional output modifiers except for prototyping, because the parsing required for them makes them slower and less efficient.