Copied to clipboard

Flag this post as spam?

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


  • Edgaras 3 posts 83 karma points
    Oct 09, 2018 @ 10:50
    Edgaras
    0

    Razor access to Member type Show on member profile value

    Hello,

    I need to display custom properties of members in frontend, but only those with Show on member profile ticked, and I can't seem to find where to retrieve that value.. enter image description here

  • Dan Diplo 1554 posts 6205 karma points MVP 5x c-trib
    Oct 09, 2018 @ 12:02
    Dan Diplo
    1

    OK, here's how you do it - but there's a caveat:

    This code will show all the member properties that are on the profile:

    var profile = Umbraco.MembershipHelper.GetCurrentMemberProfileModel();
    
    if (profile != null)
    {
        <h3>@profile.Name (@profile.MemberProperties.Count)</h3>
        foreach (var prop in profile.MemberProperties)
        {
            <p>@prop.Name: @prop.Value</p>
        }
    
    }
    

    However, for a property to be in the MemberProperties collection you have to tick both "Show on member profile" and "Member can edit" - due to a long standing bug - https://issues.umbraco.org/issue/U4-9443

Please Sign in or register to post replies

Write your reply to:

Draft