-
☆ A M B ☆
- 24,524 Posts
You could also use the MemberCheck snippet which is installed by default.
-
☆ A M B ☆
- 24,524 Posts
I don’t think there is any, other than what’s in the comments in the snippet itself. You just give it two parameters, one a list of accepted web groups and the other the chunk to show if the user is a member of one of those web groups.
# Description:
# Checks to see if users belong to a certain group and
# displays the specified chunk if they do. Performs several
# sanity checks and allows to be used multiple times on a page.
#
# Params:
# &groups [array] (REQUIRED)
# array of webuser group-names to check against
#
# &chunk [string] (REQUIRED)
# name of the chunk to use if passes the check
#
# &ph [string] (optional)
# name of the placeholder to set instead of directly retuning chunk
#
# &debug [boolean] (optional | false)
# turn on debug mode for extra troubleshooting
#
# Example Usage:
#
# [[MemberCheck? &groups=`siteadmin, registered users` &chunk=`privateSiteNav` &ph=`MemberMenu` &debug=`true`]]
#
# This would place the ’members-only’ navigation store in the chunk ’privateSiteNav’
# into a placeholder (called ’MemberMenu’). It will only do this as long as the user
# is logged in as a webuser and is a member of the ’siteadmin’ or the ’registered users’
# groups. The optional debug parameter can be used to display informative error messages
# when configuring this snippet for your site. For example, if the developer had
# mistakenly typed ’siteowners’ for the first group, and none existed with debug mode on,
# it would have returned the error message: The group siteowners could not be found....
#
dont know why we sometimes think there’s gotta be "some documentation out there"
we think too much i guess....(shrug)
-
☆ A M B ☆
- 24,524 Posts
Usually, especially for small snippets like that, the comments at the beginning of the snippet code are the documentation. Some will have documentation included in the zip package (if there is one; very small snippets often are just the one file with the snippet code to paste into a new snippet).
Most of these snippets were created by a developer on-the-job to fulfill a need for a site they’re working on, and they just don’t have the time to stop and create extra documentation. Anyone who uses a snippet is more than welcome to add documentation to the wiki, or write documentation like the excellent Wayfinder book.
Can you call a snippet from a chunk using MemberCheck?
I’m trying to call different menus based on whether or not a user is logged in. However I can’t seem to get WayFinder and Personalize or MemeberCheck to work together.
I twitch because I care....and drink too much coffee.
how did you try that?
you have to call nested snippet calls reversed unchached/cached
if you call [!Personolize............!] uncached, you have to call [[WayFinder............]] cached in personolize-chunk