Have a look at this wiki article which explains the .net membership features. Basically, you'll have to retrieve the member (you'll need a cast from MembershipUser) and set the text property as you mention in your post.
Because Membership.GetUser() returns a MembershipUser object rather than a 'Member' object. You'll need to cast to 'Member' to be able to use the .Text property (Just as said in first reply)
Would it be possible for you to make a code example? I can not work out how to use the Member object. I'm not sure if it has relevance, but I'm using the code as script directly in the template.
Sorry for posting in this old thread, but I've can't cast the MembershipUser to a Member user. I get the error "Cannot convert type 'System.Web.Security.MembershipUser' to 'umbraco.cms.businesslogic.member.Member'"
Save member name
Hi there
I have this code for creating members:
<script runat="server">
protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e)
{
Roles.AddUserToRole(CreateUserWizard1.UserName, "Group");
}
</script>
<asp:CreateUserWizard ID="CreateUserWizard1" runat="server"
OnCreatedUser="CreateUserWizard1_CreatedUser"
AutoGeneratePassword="True" >
</asp:CreateUserWizard>
Now I want the member to be able to input their "real name", and save it in the "Name" field which the Umbracho Member section already have.
The "real name" field appears to be m.Text:
http://our.umbraco.org/forum/developers/api-questions/2930-Getting-member-name
How can this be done?
Thanks in advance!
/Mathias
PS: Sorry for all my q's, but I'm a total newbee in this..
Mathias,
Have a look at this wiki article which explains the .net membership features. Basically, you'll have to retrieve the member (you'll need a cast from MembershipUser) and set the text property as you mention in your post.
Hope this helps.
Regards,
/Dirk
Thank you!
Unfortunately I'm stuck in saving the fullname:
string sName = "Test Test"; //MembershipUser memUser = Membership.GetUser(CreateUserWizard1.UserName); var memUser = Membership.GetUser(CreateUserWizard1.UserName); memUser.Text = sName; Membership.UpdateUser(memUser);
It doesnt seem to recon the "Text" property..
Mathias,
Because Membership.GetUser() returns a MembershipUser object rather than a 'Member' object. You'll need to cast to 'Member' to be able to use the .Text property (Just as said in first reply)
Cheers,
/Dirk
Would it be possible for you to make a code example? I can not work out how to use the Member object. I'm not sure if it has relevance, but I'm using the code as script directly in the template.
Thanks again, and sorry for my ignorance!
/Mathias
I found out at last!
Just had to add
in the script to use the Member object.
Sorry for posting in this old thread, but I've can't cast the MembershipUser to a Member user. I get the error "Cannot convert type 'System.Web.Security.MembershipUser' to 'umbraco.cms.businesslogic.member.Member'"
/Bo
is working on a reply...