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

  • Required fields are marked with *.

If you have trouble reading the code, click on the code itself to generate a new random code.
 
ziya
Posts: 2
Comment
How to detect document group of Document with phx
Reply #4 on : Thu January 27, 2011, 04:54:37
Hello,
I want to know How to detect document group of Document with phx as I am newbie for modx.Please let me know the procedure.
Thanks,
Ziya
cipa
Posts: 2
Comment
Re: Detect manager users with PHx
Reply #3 on : Thu January 27, 2011, 13:11:01
Try building a custom phx modifier. See the phx wiki page: http://wiki.modxcms.com/index.php/PHx
hedy
Posts: 2
Comment
The same for Revolution ?
Reply #2 on : Mon February 07, 2011, 11:44:24
I want to make this test under Revolution.
Do you know how to do this ?
cipa
Posts: 2
Comment
Re: Detect manager users with PHx
Reply #1 on : Mon February 07, 2011, 11:46:24
Have a look at IF
http://rtfm.modx.com/display/ADDON/If
The example might work for you

Quick modx Evolution Tags

  • cached [[snippet]] or uncached [!snippet!]
  • {{chunk}}
  • [+placeholder+]
  • [*resourceField/TV*]
  • [^timing^]
  • [~link~]

Quick modx Revolution Tags

  • [[snippet]]
  • [[$chunk]]
  • [[+placeholder]]
  • [[*resourceField/TV]]
  • [[~link]]
  • [^timing^]
  • [[++systemSetting]]
  • [[%languageStringKey]]
  • all tags can be called un-cached like: [[! snippet]]

Timing Tags (Evo and Revo)

  • [^qt^] - Query time
  • [^q^] - Query count
  • [^p^] - Parse time
  • [^t^] - Total time
  • [^s^] - Source
© modxRULES! 2009-2014