Copied to clipboard

Flag this post as spam?

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


  • Nicholas Magnussen 9 posts 73 karma points
    Jul 30, 2015 @ 07:56
    Nicholas Magnussen
    0

    Reading MemberGroups from properties

    I'm meddling around with Examine.

    I've come to a point where I need to find a list of members belonging to a specific membergroup.

    The question now is, are there any properties I can use with Examine, to search and thereby filter members på membergroup?

  • Dennis Aaen 4379 posts 17716 karma points admin hq c-trib
    Jul 30, 2015 @ 09:36
    Dennis Aaen
    0

    Hi Nicholas,

    You can use the Member service to to find a list of members belonging to a specific membergroup. Try to see the method called .GetMembersByGroup

    https://our.umbraco.org/DOCUMENTATION/Reference/Management-v6/Services/MemberService

    @{
        var membersInMemberGroup = ApplicationContext.Current.Services.MemberService.GetMembersByGroup("IT Member"); 
    
        foreach(var member in membersInMemberGroup.OrderBy(x => x.Name)){ 
                @member.Name
        }
    }
    

    Hope this helps,

    /Dennis

  • Nicholas Magnussen 9 posts 73 karma points
    Jul 30, 2015 @ 10:38
    Nicholas Magnussen
    0

    I know that.

    But w'ere experiecing that looping over members that way and reading properties is extremely slow. Which is why I wanted to do that using Examine instead.

    The way you're describing is how our application works currently.

  • Tito 230 posts 410 karma points
    1 week ago
    Tito
    0

    Hi Nicholas, have you found any solution? I think we need a helper that get all members from cache like the content helper instead of querying the db.

Please Sign in or register to post replies

Write your reply to:

Draft