Get Umbraco Certified in October
5 courses in 4 different countries across 2 continents leaves no excuse.
Attend courses in the Netherlands, UK, USA and at Umbraco HQ in Denmark.
See the schedule and read more about our training here.
Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
It is possible to get a member with various keys such as username, email etc.
Isn't it possible to get the member using the member ID?
It is possible to get a member using the member id.
You can make a XSLT-file and use this Umbraco Extension
umbraco.library:GetMember(Int 32 MemberId)
Then you will get a member by an ID
I haven´t try it myself, but hopefully it will solve your problem.
Thanks - I'm a total newbe on xslt and I need to fetch the member from a usercontrol.
Is there any way to do that?
I haven´t worked with usercontrols in Umbraco yet,
there's two options:
- use the member api, some docs can be found here
- use the membership api. A great overview can be found on the wiki
Thanks - as I wrote I have found various methods for getting a member - i.e. by email, username etc.
However, I store a memberID in a DB and want to be able to fetch the member using this key. Is that possible, or should I use a different key - such as username?
You can go like this:
Member m = new Member(MemberId);
That will give me a new member, but I doens't allow me to access properties of the member with ID = x.
Instead of saving the memberID in my db, I guess I'll just save the username - though it isn't the best solution...
Will this not give you the id that you neeed?
m = Member.GetCurrentMember();
Then you should be able to fetch the ID by using this line, right?
Please do note that I'm no .NET wizard but I just played a bit around with this and seems to me like it's working./Jan
Hi - It's seems that I haven't explained the problem well enough.
I need to store information about a purchase. One information data about who has actually purchase an item. I store the memberID in a db in order to fetch the member - and related properties - again. I would like to use the ID as a key for fetching the member since this is an integer an easy to use with linq/sql.
However, when I want to fetch information about the "buyer", how can I do this, when all I have is the ID?
Currently - as a work-aroung - I am storing both the ID and the loginname, since it is possible to fetch the member by loginname. However, this isn't very pretty...
Any solutions for fetching a member from the memberID?
i think you'll find Simon is correct...
Member m = new Member(memberId);
i.e. new Member(memberId) doesn't create a new member, it gets the Member's details using the memberId you pass in.
if you need to create a new member then you would use:
Member m = Member.MakeNew(...);
or to get the current member (as Jan says):
Member m = Member.GetCurrentMember().Id;
We can get User details by Id using the following code.
To get current User
UmbracoContext.UmbracoUser or UmbracoContext.Current.UmbracoUser
Write your reply to:
Image will be uploaded when post is submitted