Copied to clipboard

Flag this post as spam?

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


  • mmmoustache 50 posts 79 karma points
    May 24, 2012 @ 12:59
    mmmoustache
    0

    Retrieving member group & type of current member

    Hi Everyone,

    Is it possible to get information on the group or type of the currently logged in member? I have a site with a login feature and want to show the member different content dependending on what group the current member is in, or potentially the member type. 

    Currently I can retrieve the three properties associated with the current member using the following code:

    @using umbraco.cms.businesslogic.member

    @{
         var member = Member.GetCurrentMember();   
         <p>@member.Id - @member.Text - @member.ParentId</p>
    }

    Is there a method that allows me to retrieve group/type information based on this code?

    Kind Regards,
    mmmoustache

  • Michael Latouche 504 posts 819 karma points MVP 3x c-trib
    May 24, 2012 @ 14:14
    Michael Latouche
    1

    Hi mmmoustache,

    Normally you can use all functionalities of the ASP.Net memebrship provider. So, to check if the user is in a particular role, you can use the method

    System.Web.Security.Roles.IsUserInRole(username, rolename)
    System.Web.Security.Roles.GetRolesForUser(username)

    etc.

    Hope this helps

    Cheers,

    Michael.

  • mark 2 posts 22 karma points
    Nov 21, 2012 @ 17:37
    mark
    0

    Sadly, for users new to umbraco like me, this does not help. My task is twofold: firstly, i need to get the member groups of the current logged-in member and then secondly, to display all the content pages in these groups, both tasks in the context of an xslt file; in other words, display all content that the logged-in member is allowed to access. I have so far failed to find a good enough explanation and example that explains either of these tasks. Would appreciate it greatly should anyone like to provide a full and complete explanation of : (1) how to get the member groups of the current logged-in member, and also (b) how to get all content pages belonging to a member group.

    Cheers

    mark.

Please Sign in or register to post replies

Write your reply to:

Draft