0

Is it possible to display specific content for target audiences depending on Member Group?

Current "Public Access" mechanism allows us to provide role based restrictions for the selected page. In this case we would be able to create number of different pages depending on the number of Member Groups and assign restrictions.

I was wondering if it is possible to show different page content depending on the Member Group (on the same URL) or can I do it with different Modules? Does Umbraco already have the logic if "Member Group A" is assinged to "Module A" he shows "Module A"? Or "Member Group B" is assigned to "Module B" he shows "Module B"?

Thanks In advance!

Samuel Silva
  • 43
  • 1
  • 9

1 Answers1

1

I believe this will have to be done through custom logic... You can however use Umbraco's services (see the link below):

Umbraco - MemberGroup Service

You can use this class to determine the group the current Member belongs to. Once you have determined this, you just simply need to alternate between the different bits of content you wish to show to each different group.

Example node: FaqNode

  • RegisteredUserNotes

  • NonRegisteredUserNotes

  • OtherGroupNotes etc.

Hopefully this makes sense...

Regards

Craig

Craig Mayers
  • 185
  • 2
  • 9
  • Everytime I create a new member group will I have to change the Source code `if(membergroup == A) {contentA.visible=true}` (for example) and then add Membergroup B if I create a new Member Group? – Samuel Silva Jun 06 '17 at 12:23
  • Hi Samuel, yes that is correct! Unless you set it up with some kind of config (i.e. appSettings) - specifying the different groups and you could then do a .contains(element) to match up. You should only have to change your config file then rather than the logic. Make sense? – Craig Mayers Jun 06 '17 at 12:28
  • Yes Craig, Thank you very much for your help! – Samuel Silva Jun 06 '17 at 15:00
  • No problem! Happy coding ;) – Craig Mayers Jun 07 '17 at 13:49