Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • pvassalo 21 posts 28 karma points
    Apr 07, 2009 @ 20:05
    pvassalo
    0

    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

  • Richard Soeteman 4045 posts 12898 karma points MVP 2x
    Apr 07, 2009 @ 20:16
    Richard Soeteman
    3

    Hi,

    Not 100% sure but I think you can try the method umbraco.helper.GetCurrentUmbracoUser()

    Cheers,

    Richard

  • Ismail Mayat 4511 posts 10091 karma points MVP 2x admin c-trib
    Apr 08, 2009 @ 07:46
    Ismail Mayat
    1

    pvassalo,

    I have done it in a datatype like this:

    [code]

    User u = UmbracoEnsuredPage.CurrentUser;

    [/code]

    Regards

    Ismail

  • pvassalo 21 posts 28 karma points
    Apr 08, 2009 @ 11:25
    pvassalo
    0

    Got it! Thank you both!!

  • Kieran Harvey 22 posts 55 karma points
    Oct 19, 2012 @ 02:07
    Kieran Harvey
    0

    This worked for me.

    var member = umbraco.cms.businesslogic.member.Member.GetCurrentMember();
  • Zakhar 171 posts 397 karma points
    Sep 02, 2014 @ 17:22
    Zakhar
    1

    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();
    
  • David Court 6 posts 26 karma points
    Sep 09, 2014 @ 10:30
    David Court
    0

    Thanks for the clarification Zakhar

  • Connie DeCinko 931 posts 1160 karma points
    Jul 13, 2015 @ 16:07
    Connie DeCinko
    0

    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?

  • Jason Prothero 422 posts 1243 karma points MVP c-trib
    Jul 13, 2015 @ 17:39
    Jason Prothero
    0

    What version of Umbraco are you using?

    Thanks, Jason

  • Connie DeCinko 931 posts 1160 karma points
    Jul 13, 2015 @ 18:20
    Connie DeCinko
    0

    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.

  • Nicholas Westby 2054 posts 7103 karma points c-trib
    Jul 13, 2015 @ 21:39
    Nicholas Westby
    1

    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;
    
Please Sign in or register to post replies

Write your reply to:

Draft