MemberCheck
MemberCheck 1.1
Added the ability to define a default chunk using the &Default parameter (see below).
Checks a logged in user's group memberships and displays a chunk. Can be used multiple times on a page.
Example usage:
[!MemberCheck? &groups=`siteadmin, registered users` &chunk=`privateSiteNav` &default=`publicSiteNav` &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. Otherwise, it will place the default chunk 'publicSiteNav' into the 'MemberMenu' placeholder. 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....
Description
Checks to see if users belong to a certain group and displays the specified chunk if they do or an optional default chunk if they don't. Performs several sanity checks and allows to be used multiple times on a page.Instructions
Copy contents of file to a new snippet called "MemberCheck".Example usage:
[!MemberCheck? &groups=`siteadmin, registered users` &chunk=`privateSiteNav` &default=`publicSiteNav` &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. Otherwise, it will place the default chunk 'publicSiteNav' into the 'MemberMenu' placeholder. 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....