Copied to clipboard

Flag this post as spam?

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

  • Josh Olson 79 posts 207 karma points
    Jan 07, 2014 @ 10:55
    Josh Olson

    U7 Members: Member custom property saving mirage

    Using Umbraco 7.0.1

    I have members with a bunch of custom properties and I am trying to get/set those properties in my code. It almost works but it seems as though I am missing something, probably simple. Here is what I do:

    if (IsPost)
         var currentComments = member.getProperty("comments").Value.ToString();
         var addComments = Request["addComment"];
         var newComments = String.IsNullOrEmpty(currentComments) 
              ? @currentMember.Text + " [" + DateTime.Now.ToString("dd MMM yy - HH:mm").ToUpper() + "] - " + addComments
              : currentComments + "\n" + @currentMember.Text + " [" + DateTime.Now.ToString("dd MMM yy - HH:mm").ToUpper() + "] - " + addComments;
           member.getProperty("comments").Value = newComments;

    and this is the part of the modal window that is used to add comments

    <div class="modal-body">
         <form id="addCommentForm" method="post" role="form">
              <textarea class="form-control input-sms" rows="3"  disabled="disabled">@comments</textarea>
              <h4>Add a comment</h4>
              <textarea id="addComment" name="addComment" class="form-control" rows="1"></textarea>
    <div class="modal-footer">
         <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
         <input id="addCommentSubmit" type="submit" class="btn btn-primary" value="Add comments" />
         $('#addCommentSubmit').on('click', function (e) {

    Now, here is where it gets funny. This works. Sort of. When I enter text into the #addComment textarea and submit it, it appears in the textarea in the backend as expected and in the appropriate textarea on the frontend, but, there must be a cached xml file or something because if I reload the page on the frontend, the newly submitted text is now gone. It still appears in the backend, just no longer on the frontend.

    Here is the really goofy bit... if I go to the backend and navigate to the member, like I said, I can see that the newly submitted text is there, and I press 'Save'... it fixes things. Everything now appears on the frontend properly.

    Something is happening when I press 'Save' in the backend that is not happening when I call member.Save(). Any ideas?


  • Jeroen Breuer 4907 posts 12263 karma points MVP 4x admin c-trib
    Jan 07, 2014 @ 11:19
    Jeroen Breuer

    I always do it like this:

    member.XmlGenerate(new XmlDocument());

    Maybe that helps.


  • Josh Olson 79 posts 207 karma points
    Jan 07, 2014 @ 11:32
    Josh Olson

    I did try that also (I guess I should have mentioned it) but it did not have any effect.

    For whatever reason I generally have not used member.XmlGenerate(new XmlDocument()) because it has always worked for me without, and you know what they say about things not being broke... but I probably should be using it.

    Any other suggestions?

  • Jonathan Saxon 59 posts 86 karma points
    Jan 07, 2014 @ 17:12
    Jonathan Saxon

    I have the same issue after upgrading to 7.0.1, also I have noticed if you force application pool to recycle I can then retrieve the property any ideas.

  • Josh Olson 79 posts 207 karma points
    Jan 08, 2014 @ 08:46
    Josh Olson

    I am wondering if this is an 'undocumented feature' that needs fixing in the core, or if there is simply a new step that is needed to make this function as it has in the past? I am 50% (+- 49%) sure that it is a matter of 'refreshing' an xml document somewhere, which the backend save appearently causes but the member.Save() does not, and while Jeroen's proposed solution seems like it should work for this, at least in my case it did not.

  • Jonathan Saxon 59 posts 86 karma points
    Jan 08, 2014 @ 10:29
    Jonathan Saxon

    Josh unfortunately it didnt work for me either, I am pretty sure this worked in 7.0.0 as well so guessing something must of changed.

  • Per Ploug 865 posts 3491 karma points MVP admin
    Jan 08, 2014 @ 15:13
    Per Ploug

    Seems like a bug in 7.0.1 - has this been reported on ? - if not, could you report and refer to this thread, then I'll assign it to the 7.0.2 release

  • Josh Olson 79 posts 207 karma points
    Jan 08, 2014 @ 15:36
    Josh Olson

    Issue added to tracker: U4-4005.

    Thanks Per!

  • Mikkel Johansen 116 posts 291 karma points
    Jan 10, 2014 @ 07:59
    Mikkel Johansen

    Looks like it everytime you use member.Save(). Not only when changing custom properties.

    I have tried to test it - see code below. First I get a Member and outputs it. Then changes Login and EMail, and saves the member. Then I get the member again and outputs it. But the properties is the same . Looking in the back-end the changes is visible.

    I have added this observation to the issue tacker U4.4005,

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    @using umbraco.cms.businesslogic.member
    @using Member = umbraco.cms.businesslogic.member.Member

    Layout = null;

    // Remember to create Member in Backend
    // Member: Login = test, E-mail = [email protected]

    Member m = Member.GetMemberFromEmail("[email protected]");

    m.LoginName = "Test1234";
    m.Email = "[email protected]";


    Member testMember = Member.GetMemberFromEmail("[email protected]");

    @helper ShowMember(Member member)
    Name: @member.Text<br />
    LoginName: @member.LoginName<br />
    E-mail: @member.Email<br />
  • Josh Olson 79 posts 207 karma points
    Jan 10, 2014 @ 08:36
    Josh Olson

    Thanks Mikkel, that confirms exactly what I see happening. I never thought to test it with non-custom properties, but it looks like they are not immune also. -Josh

  • Josh Olson 79 posts 207 karma points
    Jan 21, 2014 @ 12:51
    Josh Olson

    I just upgraded to 7.0.2 and I can confirm that the bug is now fixed. Thanks to all!

Please Sign in or register to post replies

Write your reply to: