Copied to clipboard

Flag this post as spam?

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


  • mikkel 143 posts 365 karma points
    Aug 16, 2019 @ 15:51
    mikkel
    0

    Members.GetCurrentMemberProfileModel(); Dont get all data of current members

    What is the Rights Way to get all the data from members, so that i Can show it in the frontend, so that the members Can se he’s own data.

    I've tried everything in the documentation. No matter what I do, I can only view the name and email, but the proberty i have made my selv for the profile image, dont show up it is in umbraco 8 enter image description here

    The code

    @{ Layout = "master.cshtml"; } @inherits Umbraco.Web.Mvc.UmbracoViewPage @using System.Web.Mvc.Html @using ClientDependency.Core.Mvc @using Umbraco.Web @using Umbraco.Web.Models @using Umbraco.Web.Controllers @{ var loginStatusModel = Members.GetCurrentLoginStatus(); var logoutModel = new PostRedirectModel(); //send bruger til forsiden efter log ud logoutModel.RedirectUrl = "/"; } @if (loginStatusModel.IsLoggedIn) {

    Billede her

        @{
            var medlem = Members.GetCurrentMember();
            var test = Members.GetCurrentMemberProfileModel();
            var test2 = Services.MemberService.GetDefaultMemberType();
            var enTEst = Umbraco.MembershipHelper.GetCurrentMember();
            var getCurrentUser = ProfileModel.Profile();
    
            var loggedOn = Umbraco.PublishedContent.Members();
            var getCurrentUser = Umbraco.BusinessLogic.User.GetCurrent();
            var getCurrentUmbracoUser = Umbraco.helper.GetCurrentUmbracoUser();
            var securityCurrentUser = UmbracoContext.Security.CurrentUser;
            var umbracoEnsuredPageCurrentUser = Umbraco.BasePages.UmbracoEnsuredPage.CurrentUser;
        }
        <div class="container">
            <div class="col-md-4">
                <div class="form-control">
                    <h3>Hej @medlem.Name Du er nu logget ind på din side</h3>
                    <p>@enTEst.Properties</p>
                </div>
            </div>
        </div>
    
    </div>
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    var agents = Services.MemberService.GetMembersByMemberType("Member");
    
    
    
    foreach (var item in agents)
    {
    
        @item.Name
        <br />
        @item.ContentTypeAlias
        <br />
    
        @item.Email
        <br />
    
        @item.GetValue("address")
    
    }
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    using (Html.BeginUmbracoForm<UmbLoginStatusController>("HandleLogout"))
    {
        <fieldset>
            <legend>Logout</legend>
            <button>Logout</button>
        </fieldset>
        @Html.HiddenFor(m => logoutModel.RedirectUrl)
    }
    

    }

  • Amir Khan 1287 posts 2744 karma points
    Aug 16, 2019 @ 16:15
    Amir Khan
    0

    Is it just GetPropertyValue() instead of GetValue()?

  • mikkel 143 posts 365 karma points
    Aug 16, 2019 @ 18:21
    mikkel
    0

    I have try that to :)

  • Tarik 196 posts 840 karma points c-trib
    Aug 18, 2019 @ 12:29
    Tarik
    0

    but the proberty i have made my selv for the profile image

    mikkel, can you post a screenshot of that property? it's alias name, it's type and MemberType Name.

    I was able to get address property value using the following code:

    @{
          var agents = Services.MemberService.GetMembersByMemberType("Member");
          foreach (var item in agents)
    {
    
        @item.Name
        <br />
        @item.ContentTypeAlias
        <br />
    
        @item.Email
        <br />
    
        @item.GetValue("address")
    
    }
    
      }
    

    Preview: enter image description here enter image description here

  • mikkel 143 posts 365 karma points
    Aug 18, 2019 @ 20:56
    mikkel
    0

    Yes ofcouse i Will do it tommorow when i get home from work I have to try it Again and se if i Can do the same AS you 🙂

  • mikkel 143 posts 365 karma points
    Aug 19, 2019 @ 14:45
    mikkel
    0

    Here is my member documenttype i have profilbillede and adresse and i cant acces them !enter image description here

  • Tarik 196 posts 840 karma points c-trib
    Aug 20, 2019 @ 08:32
    Tarik
    100

    I used the following code:

        @item.GetValue("address")
    <br />
    
    var picture = Umbraco.Media(item.GetValue("picture"));
    if (picture != null)
    {
     <img class="ui medium circular image" src="@picture.Url">
    }
    

    Preview:

    enter image description here

    enter image description here

  • mikkel 143 posts 365 karma points
    Aug 20, 2019 @ 15:41
    mikkel
    0

    you are the best. i have seach for that problem a long time now :D and now it works. Thanks for your help

Please Sign in or register to post replies

Write your reply to:

Draft