I'm currently trying to retrieve a custom property value for a member (e.g. "City (city), Type: Textstring"). The user can successfully login, however I'm unable to retrieve any of their information?
The error I'm receiving on the below code is "The property "city" is not recognised".
@ {
var memberService = Membership.GetUser();
var profile = System.Web.Profile.ProfileBase.Create(memberService.UserName);
string memberCity = profile["city"].ToString();
// string memberCity = profile.GetPropertyValue("city").ToString();
}
I actually tried "GetPropertyValue" and this appeared to work, however I get the error message "The settings property 'city' was not found." It's almost as if Umbraco doesn't realise I have set this property set up. It's definitely in against the member type "Member".
Do I need to select "Member can edit" in the member type perhaps? Or "Show on profile"?
Great you got it to work. Please mark this as solved you have a green tick over each post, and if you click the green tick on the post that give you the solution, then you have mark this questions as solved.
So people with the same problem can see what worked for you. In this case you should mark my first post as the solution.
Retrieve a member property in Umbraco 7
Hi,
I'm currently trying to retrieve a custom property value for a member (e.g. "City (city), Type: Textstring"). The user can successfully login, however I'm unable to retrieve any of their information?
The error I'm receiving on the below code is "The property "city" is not recognised".
Thanks for any help!
Hi Steven,
I am not a backend developer, but I would try to help you anyway.
What if you are doing it this way, did it make any difference.
Hope this helps,
/Dennis
Hi Dennis,
Unfortunately your suggestion didn't work. I get alerted that getProperty is not a recognised property.
Thanks,
Steven.
Hi Steven,
Does it any difference if you use GetProperty instead of getProperty
Like this:
Or you could try this too.
Hope this helps,
/Dennis
Hi again,
I actually tried "GetPropertyValue" and this appeared to work, however I get the error message "The settings property 'city' was not found." It's almost as if Umbraco doesn't realise I have set this property set up. It's definitely in against the member type "Member".
Do I need to select "Member can edit" in the member type perhaps? Or "Show on profile"?
Thanks,
Steven.
Hi Steven,
Maybe these posts can be a help:
http://our.umbraco.org/forum/umbraco-7/using-umbraco-7/52706-U7-adding-custom-member-properties-to-the-ProfileModel
http://our.umbraco.org/forum/developers/razor/41345-Get-custom-member-properties-with-razor
Hope so,
/Dennis
Hi Dennis,
Thanks, the first post you suggested worked!
Thanks again, Steven.
Hi Steven,
Great you got it to work. Please mark this as solved you have a green tick over each post, and if you click the green tick on the post that give you the solution, then you have mark this questions as solved.
So people with the same problem can see what worked for you. In this case you should mark my first post as the solution.
/Dennis
No problem Dennis,
I don't suppose you could take a look at this post?
http://our.umbraco.org/forum/umbraco-7/using-umbraco-7/54547-Update-a-member-property-in-Umbraco-7
Thanks, Steven.
is working on a reply...