Copied to clipboard

Flag this post as spam?

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


  • Matthew Kirschner 323 posts 611 karma points
    Jun 30, 2015 @ 20:14
    Matthew Kirschner
    0

    Is Current Member an Umbraco User or a Member?

    I'm trying to figure out the best way to query the currently signed in "member" and determine if they are signed in as an Umbraco User or Umbraco Member or both.

    I want to be able to simply say:

    var currentMember = GetCurrentMember();
    
    if (currentMember == null) return "Not signed in";
    
    if (currentMember.IsUser) return "Signed in as a Backoffice User";
    
    if (currentMember.IsMember) return "Signed in as a Frontend Member";
    

    Here's what I have so far:

    Using umbraco.helper.GetCurrentUmbracoUser() will return whether or not the current member is a User. If the current member is signed in as a User and a Member, this call will return null.

    MembershopHelper.GetCurrentMember() will return a valid IPublishedContent regardless of whether the member is a User or Member.

    So, in order to determine whether the current member is a User or Member, I have to use both of these calls and compare the results.

    Isn't there a better way?

  • Barry Fogarty 493 posts 1129 karma points
    Jun 30, 2015 @ 21:06
    Barry Fogarty
    100

    I'm afraid not - The concepts of users and members in Umbraco are totally separate. The GetCurrentMember() call always refers to the front end website members.

    The purpose of each type is very different so for most use cases it makes sense not to have any crossover between them.

Please Sign in or register to post replies

Write your reply to:

Draft