visitor

An article by Gaspard Bucher

move into the context of the visitor (User)

  1. action
  2. ajax
  3. API
  4. classes
  5. common attributes
  6. conditions
  7. context
    1. ancestors
    2. author
    3. comments
    4. comments_to_publish
    5. content_for_layout
    6. context
    7. count
    8. data
    9. each
    10. each_group
    11. expand_with
    12. find
    13. group
    14. node
    15. project
    16. proposed
    17. query
    18. query_errors
    19. query_parse
    20. real_project
    21. real_section
    22. redactions
    23. replies
    24. search_results
    25. section
    26. tags
    27. to_publish
    28. unknown
    29. user
    30. visitor
    31. visitor_node
  8. dates
  9. display
  10. forms
  11. i18n
  12. meta
  13. SQLiss
  14. urls

move into the context of the visitor (User)

see user, visitor_node, zena 1.0

Example to show the visitor’s login name:

<r:visitor do='login'/>

You can move further to the visitor’s Contact node with “node” or “contact” :

<r:visitor do='node' do='mobile'/>

You can also use the shortcut visitor_node to do the same as above:

<r:visitor_node do='mobile'/>

Filtering by current visitor

If you need to filter elements that have been created by the current visitor, here is how you can do this:

nodes where user_id = #{visitor.id} order by created_at desc limit 5