I'm trying to use the MemberShipProvider exclusively to create new members. It is my understanding that the ProfileProvider has also been implemented in the latest versions of Umbraco, so this should not be very difficult.
I want to add extra fields to the registration page, for example: "Last name".
The membership provider in my web.config is set to:
So as soon as the user has been created the Profile.lastname value should be set.
I get a nice message saying that a new member has been created, but when I look in the backoffice, it has not saved the "lastname" property. I checked the casing of the "lastname" alias on my member type properties, it is all lower case so that should not be a problem. Besides, I get no errors anywhere.
So... Who's tried using the profile provider and has succeeded? I know I can do it the manual way, but the whole point of the membership provider is that I shouldn't have to go through the umbraco API any more.
I'd think you can use profile data when member has been created...and you'll have to set the values first... in the CreatedUser event... but I could be completely wrong of course... Correct if I am!
Thanks Dirk & Morten, I am a few big steps further along now.
Created a class like in Aaron's blog post, in my master page I actually get firstname, lastname and middlename as autocompletion for "Profile.".
So you'd think it would work.... Think again, nothing seems to be saved to the database.
Also, how do I get rid of this code in my masterpage, I'm not sure how I can seperate it out. I tried making a class in my new Member project, but obviously, it doesn't know what CreateUserWizard1 is, not that there is a Profile.lastname property (for example). Should I also move the masterpage to the member project and have the postbuild copy it to the website?
Creating members with custom properties
I'm trying to use the MemberShipProvider exclusively to create new members. It is my understanding that the ProfileProvider has also been implemented in the latest versions of Umbraco, so this should not be very difficult.
I want to add extra fields to the registration page, for example: "Last name".
The membership provider in my web.config is set to:
And I've added an extra section under that for the profile values:
After reading this article, it sounds as if I can very easily save the profile information, the "create user" template looks like this:
<%@ Master Language="C#" MasterPageFile="/masterpages/Master.master" AutoEventWireup="true" %> <script Langauge="C#" runat="server"> protected void CreatedUser(Object sender, EventArgs e) { /* User is created and setting extra parameters to profile */ TextBox lastname= (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("lastname"); Profile.lastname = lastname.Text; } </script> <asp:content ContentPlaceHolderId="body" runat="server"> <form runat="server"> <asp:CreateUserWizard ID="CreateUserWizard1" OnCreatedUser="CreatedUser" runat="server"> <WizardSteps> <asp:CreateUserWizardStep ID="CreateUserWizardStep1" runat="server"> <ContentTemplate> <asp:TextBox Runat="server" ID="lastname"></asp:TextBox><br /> <asp:TextBox Runat="server" ID="username"></asp:TextBox><br /> <asp:TextBox Runat="server" ID="password"></asp:TextBox><br /> <asp:TextBox Runat="server" ID="email"></asp:TextBox><br /> </ContentTemplate> </asp:CreateUserWizardStep> <asp:CompleteWizardStep ID="CompleteWizardStep1" runat="server"> </asp:CompleteWizardStep> </WizardSteps> </asp:CreateUserWizard> </form> </asp:content>
So as soon as the user has been created the Profile.lastname value should be set.
I get a nice message saying that a new member has been created, but when I look in the backoffice, it has not saved the "lastname" property.
I checked the casing of the "lastname" alias on my member type properties, it is all lower case so that should not be a problem. Besides, I get no errors anywhere.
So... Who's tried using the profile provider and has succeeded? I know I can do it the manual way, but the whole point of the membership provider is that I shouldn't have to go through the umbraco API any more.
Sebastiaan, not sure if Aaron's post is of any relevance to you... but here's the pointer to his blog post about membership, profile provider stuff
I haven't been into that much details (as in "haven't implemented it") but would love to know if you can get it to work...
Cheers,
/Dirk
I'd think you can use profile data when member has been created...and you'll have to set the values first... in the CreatedUser event... but I could be completely wrong of course... Correct if I am!
Cheers,
/Dirk
I have not tried it either, but you may need to set the provider explicitly:
Try it out :-)
Thanks Dirk & Morten, I am a few big steps further along now.
Created a class like in Aaron's blog post, in my master page I actually get firstname, lastname and middlename as autocompletion for "Profile.".
So you'd think it would work.... Think again, nothing seems to be saved to the database.
Also, how do I get rid of this code in my masterpage, I'm not sure how I can seperate it out. I tried making a class in my new Member project, but obviously, it doesn't know what CreateUserWizard1 is, not that there is a Profile.lastname property (for example).
Should I also move the masterpage to the member project and have the postbuild copy it to the website?
I was hoping that this would just link up the profile properties to the umbraco member properties, but there's still some programming involved.
Also, realistically, how often am I going to be changing the membership provider in my running website? ;-)
So for now, I might as well do it the old-fashioned way and target the umbraco API directly, until I have some time to investigate this further.
Hi Sebastian,
Did you ever get this working?
I'm using V4.7 now and having the same trouble getting the extra fields saved for the member in Umbraco.
Regards,
Matt
-------
Solved my problem, http://our.umbraco.org/forum/developers/api-questions/12348-member-profile-problem-45x?p=0#comment76619
is working on a reply...