Detect manager users with PHx
on 14-Oct-2010 | Comments ( 4 ) Tags: Evolution, PHx
Make sure your resource is not cacheable. This is a quick solution for when you need to test something. A more appropriate solution is to use an uncached snippet and have the resource cacheable
In order to detect manager users we'll use the role field(see modx_user_attributes table). Because Web Users have the role 0 and visitors don't have a role, we can easily detect which user is viewing a page.
We'll also take advantage of PHx's userinfo special modifier. More details here.
[+phx:userinfo=`role`:gt=`0`:then=`
<h2>Manager Users</h2>
`:else=`
<h2>All Other Users</h2>
`+]
You can use this solution to test a new section of your website, not ready for regular users. Share your own method in the comments section.

Write a comment
Posts: 2
Reply #4 on : Thu January 27, 2011, 05:54:37
Posts: 2
Reply #3 on : Thu January 27, 2011, 14:11:01
Posts: 2
Reply #2 on : Mon February 07, 2011, 12:44:24
Posts: 2
Reply #1 on : Mon February 07, 2011, 12:46:24