Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > K# Get Memberships View modes: 
User avatar
Member
Member
sdobbins-reportingguru - 2/10/2014 12:26:09 PM
   
K# Get Memberships
Hey All,

So I am having an issue. I have created a test membership and added a couple of users to that membership. While logged in as any of the users in the membership, when I run the command CurrentUser.HasAnyMemberships(), it comes back true. All good so far.

However, when I run CurrentUser.Memberships.Count, it comes back with 0. The ideal would be to call CurrentUser.Memberships.FirstItem.DisplayName, to determine which membership they are a part of, however, it comes back null/blank.

What could I be missing?

Thanks!

User avatar
Kentico Consulting
Kentico Consulting
Kentico_RichardS - 2/20/2014 4:21:31 AM
   
RE:K# Get Memberships
Hi,

Thank you for your message.

The reason this is happening is because the macro you listed is getting the information out of Online marketing membership section.

From your description it seems that you need to get the membership which a user has assigned in the CMS Desk -> Users -> Edit user -> Membership section, is that correct?

Unfortunately currently there is no built-in macro for this purpose. You would need to create a custom macro method in which you could get the information out of the UserInfo object.

Let me know if you have any other questions.

Kind regards,
Richard Sustek