Copied to clipboard

Flag this post as spam?

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


  • Bryan Noriega 4 posts 35 karma points
    Feb 24, 2022 @ 11:45
    Bryan Noriega
    0

    MembershipHelper in umbraco 9

    Hi everyone,

    We are redoing an old website made inumbraco 7 with umbraco 9. On umbraco 7 to get the current member in a controller we used to do this

    var memHelper = new MembershipHelper(UmbracoContext.Current);
    var member = memHelper.GetCurrentMember();
    

    But MembershipHelper seems to not be available anymore in Umbraco 9.

    Do you know what is the alternative for this?

    Thanks!.

  • Jannik Anker 48 posts 258 karma points c-trib
    Feb 24, 2022 @ 13:12
    Jannik Anker
    100

    There is a IMemberManager instead, as far as I can see: https://apidocs.umbraco.com/v9/csharp/api/Umbraco.Cms.Core.Security.IMemberManager.html#methods

    So you'd inject IMemberManager into your controller and await GetCurrentMemberAsync() instead, maybe?

    EDIT: here's a better explanation :-) https://our.umbraco.com/documentation/Reference/Querying/IMemberManager/

  • Bryan Noriega 4 posts 35 karma points
    Feb 24, 2022 @ 13:26
    Bryan Noriega
    1

    That's the one, thank you very much!

  • Jannik Anker 48 posts 258 karma points c-trib
    Feb 24, 2022 @ 15:35
    Jannik Anker
    0

    Excellent! And BTW, remember to mark as solution so people can see there's help to get here :-D

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies