Skip to content

Commit f184b8d

Browse files
author
Warren Buckley
committed
Update readme with example of our-member-include & exclude
1 parent 8240c12 commit f184b8d

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,24 @@ This tag helper element `<our-version>` prints out version number for a given As
209209
<our-version="Our.Umbraco.TagHelpers" />
210210
```
211211

212+
## `our-member-include` and `our-member-exclude`
213+
This is a tag helper attribute that can be applied to any DOM element in the razor template or partial. It will show or hide its element and children on the page when passing a comma seperated string of member groups that the current logged in member for the exclude or include variants.
214+
215+
There are two special Member Groups you can use:
216+
* `*` - All anonymous users
217+
* `?` - All authenticated users
218+
219+
```cshtml
220+
<div our-member-include="Staff">Only members of Staff Member Group will see this.</div>
221+
<div our-member-include="Staff,Admins">Only members of Staff OR Admins member group will see this.</div>
222+
<div our-member-include="*">Only logged in members will see this.</div>
223+
<div our-member-include="?">Only anonymous members will see this.</div>
224+
225+
<div our-member-exclude="Staff">Only Staff members can't see this (Including anonymous).</div>
226+
<div our-member-exclude="?">Everyone except Anonymous members will see this.</div>
227+
<div our-member-exclude="*">Everyone except who is authenticated will see this.</div>
228+
```
229+
212230
## Video 📺
213231
[![How to create ASP.NET TagHelpers for Umbraco](https://user-images.githubusercontent.com/1389894/138666925-15475216-239f-439d-b989-c67995e5df71.png)](https://www.youtube.com/watch?v=3fkDs0NwIE8)
214232

0 commit comments

Comments
 (0)