Copied to clipboard

Flag this post as spam?

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


  • Farshad 2 posts 72 karma points
    Nov 24, 2022 @ 10:14
    Farshad
    0

    Find the member group of a member in umbraco 10

    How to get the member groups of current member in Umbraco 10?

  • Huw Reddick 1702 posts 5999 karma points MVP c-trib
    Nov 24, 2022 @ 10:23
    Huw Reddick
    1

    us the MemberManager service

        var currentUser = _memberManager.GetCurrentMemberAsync().Result;
    
        var roles = _memberManager.GetRolesAsync(currentUser).Result;
    
  • girish 6 posts 78 karma points
    Dec 16, 2022 @ 21:11
    girish
    0

    To get all the member groups then you have to use the IMemberGroupService

    _memberGroupService.GetAll();
    

    To get a particular member details then, there you have to use IMemberManager

    _memberManager.GetRolesAsync(user)
    

    And to get the current user

    _memberManager.GetCurrentMemberAsync()
    

    If you have the userId or Email then

    Id:

    _memberManager.FindByIdAsync(UserId)
    

    Email:

    _memberManager.FindByEmailAsync(email)
    

    Use .Result to get the result value from Task<TResult>

Please Sign in or register to post replies

Write your reply to:

Draft