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:
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?
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.
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.
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.
Seems like a bug in 7.0.1 - has this been reported on issues.umbraco.org ? - if not, could you report and refer to this thread, then I'll assign it to the 7.0.2 release
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]"); @ShowMember(m)
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
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:
and this is the part of the modal window that is used to add comments
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?Cheers!
I always do it like this:
Maybe that helps.
Jeroen
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?
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.
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.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.
Seems like a bug in 7.0.1 - has this been reported on issues.umbraco.org ? - if not, could you report and refer to this thread, then I'll assign it to the 7.0.2 release
Issue added to tracker: U4-4005.
Thanks Per!
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]");
@ShowMember(m)
m.LoginName = "Test1234";
m.Email = "[email protected]";
m.Save();
Member testMember = Member.GetMemberFromEmail("[email protected]");
@ShowMember(testMember)
}
@helper ShowMember(Member member)
{
<p>
Name: @member.Text<br />
LoginName: @member.LoginName<br />
E-mail: @member.Email<br />
</p>
}
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
I just upgraded to 7.0.2 and I can confirm that the bug is now fixed. Thanks to all!
is working on a reply...