I was wondering if anyone knows of a way to get the member type of the current member that is logged in? I was guessing that the following might work, but it did not so I'm back to square one.
@nodeTypeAlias is what you're looking for.
Be aware though that @nodeTypeAlias is returning the... alias. If you can live with that, that's fine, if you need the exact member type's name, you'll need some code to get the type name based on the alias (Either inline c# script or through xslt extensions - the latter would be overkill here)
To get the name based on alias, use MemberType.GetByAlias(string alias)
Sorry to reactivate an old post but is anyone able to provide an example of an xsl:if statement that checks MemberType.GetByAlias(string alias) witihn an xslt.
I am looking to build a member navigatoin that is based on member type.
Further to my earlier post I thought I'd post a snippet of code I have just written - maybe someone else with the same predicament will find it useful:
String memberLoginName = Member.GetCurrentMember().LoginName; MembershipUser User = Membership.GetUser(memberLoginName); Member member = new Member((int)User.ProviderUserKey);
if (member.ContentType.Text == MemberType.GetByAlias("CompanyEmployee").Text) { memberList.Text = "I am a Company Employee member type"; } else if (member.ContentType.Text == MemberType.GetByAlias("CompanyRecord").Text) { memberList.Text = "I am a Company Record member type"; }
Maybe there is a better way but this can be wrapped up into a macro and output on the page.
Accessing the Member Type of the current member
I was wondering if anyone knows of a way to get the member type of the current member that is logged in? I was guessing that the following might work, but it did not so I'm back to square one.
Thanks in advance.
Hi,
@nodeTypeAlias is what you're looking for.
Be aware though that @nodeTypeAlias is returning the... alias. If you can live with that, that's fine, if you need the exact member type's name, you'll need some code to get the type name based on the alias (Either inline c# script or through xslt extensions - the latter would be overkill here)
To get the name based on alias, use MemberType.GetByAlias(string alias)
Hope this helps.
Regards,
/Dirk
Thanks! That is exactly what I wanted.
Sorry to reactivate an old post but is anyone able to provide an example of an xsl:if statement that checks MemberType.GetByAlias(string alias) witihn an xslt.
I am looking to build a member navigatoin that is based on member type.
Thanks in advance.
Further to my earlier post I thought I'd post a snippet of code I have just written - maybe someone else with the same predicament will find it useful:
Maybe there is a better way but this can be wrapped up into a macro and output on the page.
is working on a reply...