Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Current Member Groups


Go to End


795 Views

Avatar
Arbee

Community Member, 31 Posts

26 September 2016 at 9:37pm

I have a dataobject called workshop. Each workshop has an active group. I need to find out if the current member is in the active group. I can do this in the template where all the workshops loop and I check to see if the current member is in the active group:

<% loop $Workshops %>
<% if $CurrentMember.inGroup($ActiveGroupID) %>
<li><h3>$WorkshopTitle</h3></li>
<% end_if %>
<% end_loop %>

While this works for a handful of workshops, it's not really ideal for lots. How do I achieve the same thing by only calling the workshops I need rather than calling them all to check? Some sort of filter on Workshops::get()? Help!

Thanks in advance.