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
Hi, i'm creating an handler do log changes made to any node. How can I get the username of the current logged in user (in the backoffice)? thanks
Hi, Not 100% sure but I think you can try the method umbraco.helper.GetCurrentUmbracoUser() Cheers, Richard
pvassalo, I have done it in a datatype like this: [code] User u = UmbracoEnsuredPage.CurrentUser; [/code] Regards Ismail
Got it! Thank you both!!
This worked for me.
var member = umbraco.cms.businesslogic.member.Member.GetCurrentMember();
Just to avoid confusion caused by the above answers:
To get umbraco backend user (from Users section):
umbraco.BusinessLogic.User u = umbraco.helper.GetCurrentUmbracoUser();
To get current logged in website member (from Members section):
using umbraco.cms.businesslogic.member; ... Member member = Member.GetCurrentMember();
Thanks for the clarification Zakhar
In using this, I am finding it is not showing me the information for the currently logged in person. Instead it is showing the details for the past person to login to the web site. How can that be? How do I see who I am logged in as?
What version of Umbraco are you using?
Thanks, Jason
I think I solved this. I had my code in a macro that was being cached for a minute and only at the page level, not for the user.
For Umbraco 7, and assuming you are in a class that inherits from Umbraco.Web.UI.Pages.UmbracoEnsuredPage, you can simply call:
var user = Security.CurrentUser;
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Get Current Logged In User
Hi,
i'm creating an handler do log changes made to any node.
How can I get the username of the current logged in user (in the backoffice)?
thanks
Hi,
Not 100% sure but I think you can try the method umbraco.helper.GetCurrentUmbracoUser()
Cheers,
Richard
pvassalo,
I have done it in a datatype like this:
[code]
User u = UmbracoEnsuredPage.CurrentUser;
[/code]
Regards
Ismail
Got it! Thank you both!!
This worked for me.
Just to avoid confusion caused by the above answers:
To get umbraco backend user (from Users section):
To get current logged in website member (from Members section):
Thanks for the clarification Zakhar
In using this, I am finding it is not showing me the information for the currently logged in person. Instead it is showing the details for the past person to login to the web site. How can that be? How do I see who I am logged in as?
What version of Umbraco are you using?
Thanks, Jason
I think I solved this. I had my code in a macro that was being cached for a minute and only at the page level, not for the user.
For Umbraco 7, and assuming you are in a class that inherits from Umbraco.Web.UI.Pages.UmbracoEnsuredPage, you can simply call:
is working on a reply...