I am writing a backoffice extension for Umbraco v6.1.6.
I want to record details of who has done what from within my extension. So - I am retrieving the ID of the currently logged in user with the following code, and storing this in my database table...
int CurrentUserId = UmbracoContext.Current.UmbracoUser.Id;
What I now need to do is retrieve a user's name from a given ID (so that when someone else logs in to the backoffice, they can see who else did things).
I've had a look in the Umbraco source but it looks like the UserService is 'internal'. Could someone point me in the right direction, please?!
Get Umbraco User Details in Umbraco v6.1.6
I am writing a backoffice extension for Umbraco v6.1.6.
I want to record details of who has done what from within my extension. So - I am retrieving the ID of the currently logged in user with the following code, and storing this in my database table...
What I now need to do is retrieve a user's name from a given ID (so that when someone else logs in to the backoffice, they can see who else did things).
I've had a look in the Umbraco source but it looks like the UserService is 'internal'. Could someone point me in the right direction, please?!
Many thanks!
- Chris
Would
UmbracoContext.Current.UmbracoUser.Name
give you the required user's name?Hi Tom,
Thanks for your reply - but that will only give me the name of the current user. What I need to do is get the name of any user from their ID.
Thanks,
- Chris
Still looking for a solution to this if anyone can help!?
Thanks,
- Chris
You should able to initialize a user using their ID:
This will not create a new user, but get the existing user from the database.
That looks to have done the trick!
Great help - thank you!
- Chris
is working on a reply...