Open harvzor opened 7 years ago
@HarveyWilliams the reason why you need to use "Email" is because this specific alias is resolved to lookup the internal property value of the email field on members. https://github.com/umbraco/Umbraco-CMS/blob/5397f2c53acbdeb0805e1fe39fda938f571d295a/src/Umbraco.Web/PublishedCache/MemberPublishedContent.cs#L132-L138
However it would be nice if you could get the property value by using camelcase syntax like the default suggested property alias when adding a new property to a document, media or member type. http://issues.umbraco.org/issue/U4-10383
It would also be great if ModelsBuilder generated properties for the Membership properties like e.g. the "Email" property.
@zpqrtbnk is it possible that ModelsBuilder also can ensure to generate a property for Email
?
At the moment I have to do something like this:
var memberShipHelper = new MembershipHelper(UmbracoContext.Current);
var member = memberShipHelper.GetById(pickupId).OfType<ContentModels.ClickAndCollect>();
addressDetails.ShippingAddress.CompanyName = member.ApoName;
addressDetails.ShippingAddress.Line1 = member.Address;
addressDetails.ShippingAddress.Line2 = "";
addressDetails.ShippingAddress.PostalCode = member.Zip;
addressDetails.ShippingAddress.City = member.City;
addressDetails.ShippingAddress.PhoneNumber = member.Phone;
addressDetails.ShippingAddress.EmailAddress = member.GetPropertyValue<string>("Email");
where the the Email
property needs to be uppercase E
and is resolved to _umb_email
in the internal code in core.
Maybe also a property for _umb_login
, which is login/username.
I'm not sure if this is a problem with Umbraco or ModelsBuilder - I'm guessing it's Umbraco because the property is pretty weird.
The property name in the Umbraco office for a member email is
_umb_email
(visible when you hover over the default Email in Umbraco):For some reason, to get the data for a member you have to use the alias
Email
.But anyway, this property isn't enabled by default on a member so I have to add a property:
Is there anything that can be done about this in the ModelsBuilder?