There isn't a method in the MemberService that get's me the current logged in member.
The MembershipHelper.GetCurrentMember returns a member in a format (IPublishedContent) which i don't know how to use and can't convert to IMember which the MemberService is using.
What is the best way to get the current logged in member?
But then the problem arises when you want to use the new MembershipService together with the "old" type of umbraco member since they are not the same type.
I don't think there is way to convert between the two without first obtaining the Member ID you wish to convert. You could try the following:
var oldMember = umbraco.cms.businesslogic.member.Member.GetCurrentMember();
var newMember = ApplicationContext.Services.MemberService.GetById(oldMember.Id);
If you were to only use the new services, to find the current Member you could use the following:
var username = Membership.GetUser().UserName;
var member = ApplicationContext.Services.MemberService.GetByUsername(username);
How to get logged in member?
There isn't a method in the MemberService that get's me the current logged in member.
The MembershipHelper.GetCurrentMember returns a member in a format (IPublishedContent) which i don't know how to use and can't convert to IMember which the MemberService is using.
What is the best way to get the current logged in member?
Hi Jan,
You can either use the built in .NET Membership provider method:
Or the old way using:
Thanks, Dan.
But then the problem arises when you want to use the new MembershipService together with the "old" type of umbraco member since they are not the same type.
How do I convert the old type to IMember?
I don't think there is way to convert between the two without first obtaining the Member ID you wish to convert. You could try the following:
If you were to only use the new services, to find the current Member you could use the following:
For the benefit of future searchers, you are able to get
Which returns a read-only object like IPublishedContent, but with the other member-specific properties too (Username, Email, IsApproved etc).
You'll still need to use the MemberService to save data but this is a handy cast for display purposes.
is working on a reply...