Copied to clipboard

Flag this post as spam?

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


  • bparks 23 posts 79 karma points
    Jan 06, 2014 @ 08:38
    bparks
    0

    Member Properties in 7.0.1

    I have created a "SiteMember" member type which contains 8 properties.  I have been unable to save values to these properties in 7.0.1 using a custom ASP.NET profile provider -- I have done similar successfully in v6.0.5, so I'm not sure what's different...

    I can save values to the member's properties using:
    myMember.getProperty("propertyName").Value = value;
    ...

    That works OK.

    The problem with this approach is that the properties are being overwritten when the member logs in.  I've watched SQL Profiler, and when I log a member in (ValidateUser(), then SetAuthCookie()), I see 8 updates to cmsPropertyData table which are overwriting the member's properties with empty values.

    When I try to update the user using my custom profile provider (by calling myProfile.Save()), the same thing appears to happen -- 8 inserts (since the property records don't yet exist), followed by 8 updates with blank values.  I know that my app is passing the data for these values correctly to my surface controller, because writing the values directly using the Member object works OK.

    My custom profile provider class (and web.config) are copied over from a working solution in v6.0.5.  The only difference is that the 7.0.1 project throws an exception when writing the profile data if the properties are defined in the profile section in web.config, so I've commented those out. 

    Any ideas will be appreciated.

     

     

     

     

  • Kev Sherratt 2 posts 22 karma points
    Jan 09, 2014 @ 23:12
    Kev Sherratt
    0

    I don't have a solution but just wanted to perhaps throw you a little backup as I'm seeing similar issues with 7.0.1.

    I've added a handful of properties to the default Member type and the behaviour seems to be erratic. I can create the member either through a profile or the Member API and according to the backoffice UI, they're there but using the m.getProperty(foo).Value call in the front end just gives me empty strings for everything. BUT, if I touch the web.config to bounce the site, the properties come flowing back for that member, yet if I create another member the same way, the same empty strings happen. Also, if I save the same member using the backoffice UI, it wipes out some of the previously set properties but leaves others; similarly, if I then assign in my custom front-end m.getProperty(foo).Value = "bar" and m.Save(), it wipes any property I haven't assigned (which is all of them except foo in this case!)

    I've spent the best part of two days going nuts over my own code, but I'm coming to the conclusion there's something wrong somewhere else - I mean, it's hard to go wrong with the two lines..

    var m = Member.GetMemberFromLoginName(name);
    var v = m.getProperty("exampleName").Value;
    

    ..unless I'm being incredibly dimwitted! Which isn't impossible :)

    EDIT: Further to this, my current experiment is showing blank properties for the profile approach and getMemberFromLoginName() yet if I GetAll members and find the one with the username (all in the same page and code block) then the results are populated in this one. I'm suspecting some kind of caching issue - am going to see what the CMS source says.

  • bparks 23 posts 79 karma points
    Jan 13, 2014 @ 08:14
    bparks
    0

    So, I abandoned using the profile provider alltogether, since there's obviously something wrong there.  I'm able to set properties on a member as follows and I have verified that they are being set correctly, but when I try to retrieve them I get the old values (or blanks, in the case of a new member).  If I save the member from the Umbraco UI everything works as expected.  This seems to be a caching issue, but I've tried various solutions for updating the member cache with no luck... see below where i've tried XMLGenerate, RemoveMemberFromCache, AddMemberToCache, etc.

    This project is past due for a customer, so I'd appreciate any help that anyone can provide re: reading member properties.

     var mt = MemberType.GetByAlias("SiteMember");

      var newMember = Member.MakeNew(model.Username, mt, new User(0));

                newMember.getProperty("firstName").Value = model.FirstName;
                newMember.getProperty("lastName").Value = model.LastName;
                newMember.getProperty("isApproved").Value = 1;
                newMember.getProperty("isLocked").Value = 0;

                newMember.Email = model.Email;
              
                newMember.XmlGenerate(new System.Xml.XmlDocument());
                newMember.Save();

                var someGroup = MemberGroup.GetByName("somegroup");
                newMember.AddGroup(someGroup.Id);

                Member.RemoveMemberFromCache(newMember.Id);
                Member.AddMemberToCache(newMember);

  • Tom Van Rompaey 38 posts 136 karma points
    Jan 13, 2014 @ 09:41
    Tom Van Rompaey
    0

    I currently have this problem as well and it's really frustrating that I spend hours to find the right solution and it still doens't work liked it should.... "Luckily" we're not alone with this problem and I believe it will be fixed in Umbraco 7.0.2 release, fingers crossed! 

    http://issues.umbraco.org/issue/U4-4005

  • bparks 23 posts 79 karma points
    Jan 13, 2014 @ 19:41
    bparks
    0

    Thanks for letting me know about the bug report.  Unfortunately, I need this fixed immediately and can't wait for the 7.0.2 release... anyone have experience with using a nightly build in production, or have any suggestions about how to integrate the fix quickly?  :)

    thanks.

Please Sign in or register to post replies

Write your reply to:

Draft