Copied to clipboard

Flag this post as spam?

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


  • James Jackson-South 489 posts 1747 karma points c-trib
    Jun 15, 2015 @ 13:20
    James Jackson-South
    0

    Member properties not populated.

    v 7.2.4

    Using the following code:

      protected override void ApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {
            const string IsApproved = Constants.Conventions.Member.IsApproved;
            string documentType = typeof(Foo).Name;
    
            MemberService.Saved += (sender, args) =>
            {
                foreach (IMember member in args.SavedEntities)
                {
                    var mhelper = new MembershipHelper(UmbracoContext.Current);
                    var m = mh.GetById(member.Id);
                    var isFoo = m.DocumentTypeAlias.InvariantEquals(documentType);
                    var isApproved = m.GetPropertyValue<bool>(IsApproved);
    
    
                }
            };
        }
    

    It appears to me that none of the built in member properties are correctly populated.

    isApproved returns false plus no other core properties have a value. I can see Is Approved as populated in my current back office.

    Any ideas?

  • Steve Morgan 1346 posts 4455 karma points c-trib
    Jun 15, 2015 @ 14:38
    Steve Morgan
    0

    I'm no expert with members but IsApproved is a property on the IMember .. I always use the memberService like this now.

    Try something like (obviously replace GetByEmail with GetById):

      var curMember = Services.MemberService.GetByEmail(model.Username);
    
     if (!curMember.IsApproved) {
    }
    
  • James Jackson-South 489 posts 1747 karma points c-trib
    Jun 15, 2015 @ 15:00
    James Jackson-South
    0

    Thanks yeah, I would use that also normally but I need to determine the type of member so I am testing against the DocType. I wonder if I've missed something on IMember which will allow me to do that?

Please Sign in or register to post replies

Write your reply to:

Draft