CGUserDirectory filter search result based on group
Posted: Thu Nov 11, 2010 3:35 pm
If you use {CGUserDirectory group="members"} in a page you can filter what users to see in the list. But if you do a search on user properties the result also shows users not belonging to that group.
My way around it is this little trick in the summary template:
NB! This won't work if a user belong to several groups
Hope someone finds it useful.
My way around it is this little trick in the summary template:
Code: Select all
{foreach from=$users item='oneuser'}
{foreach from=$oneuser.groups item='onegroup'}
{assign var="groupname" value=$groups.$onegroup.groupname}
{/foreach}
{if $groupname == "members"}
Show content.
{/if}
{/foreach}
Hope someone finds it useful.