I am a asp.net developer but pretty new to umbraco , In members we can create new members, but how I include this as form for sign up, and how to add additional fields such as comoany name telephone contact name address so on.. please guide from scratch.
The additional fields on the member you need create as properties on your member type in Umbraco and then it should be possible for you to create a user control based on the above adding some additional fields in the form where you can use the API to fetch those values and populate them into the correct fields on the newly created member.
You can read more about the membershop API in here:http://our.umbraco.org/wiki/reference/api-cheatsheet/working-with-members
And generally you can read more API examples overall in here:http://our.umbraco.org/wiki/reference/api-cheatsheet
I hope the above pointers are enought to get you started? :-)
sort problem when add businesslogic.dll. to check user exist or not i have used Member.IsMember(String username) and to check user exist with given email I am going to use System.Web.Security.Membership.GetUserNameByEmail(String Email)
Error creating control (usercontrols/mySignUPUserControl.ascx). Maybe file doesn't exists or the usercontrol has a cache directive, which is not allowed! See the tracestack for more information!
I got this error after added it in page ? this is my code
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using umbraco.cms.businesslogic.member ;
namespace umbracoUsercontrols { public partial class mySignUPUserControl : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) {
When you have made your build are you then sure you have remembered to copy both the generated .dll and user control over in the proper folders in your installation?
additional fields in membership and sign up page
I am a asp.net developer but pretty new to umbraco , In members we can create new members, but how I include this as form for sign up, and how to add additional fields such as comoany name telephone contact name address so on.. please guide from scratch.
Hi Pat and welcome to the wonderfull world of Umbraco.
Since Umbraco is based on the standard ASP.NET membership provider it's pretty easy to create signup form. I think you can benefit from reading more about the "CreateUserWizard" control here: http://msdn.microsoft.com/en-us/library/ms178329.aspx#the_createuserwizard_control.
The additional fields on the member you need create as properties on your member type in Umbraco and then it should be possible for you to create a user control based on the above adding some additional fields in the form where you can use the API to fetch those values and populate them into the correct fields on the newly created member.
You can read more about the membershop API in here:http://our.umbraco.org/wiki/reference/api-cheatsheet/working-with-members
And generally you can read more API examples overall in here:http://our.umbraco.org/wiki/reference/api-cheatsheet
I hope the above pointers are enought to get you started? :-)
/Jan
In my code User underline in read, I have add reference to umbraco.dll and cms.dll from website bin folder did I missed something?
Member m = Member.MakeNew(tusername.Text, dt, new umbraco.BusinessLogic.User(0));
Hi Pat
Do you get any errors in visual studio? If so...what does it say?
/Jan
sort problem when add businesslogic.dll. to check user exist or not i have used Member.IsMember(String username) and to check user exist with given email I am going to use System.Web.Security.Membership.GetUserNameByEmail(String Email)
hope this should work?
Maybe file doesn't exists or the usercontrol has a cache directive, which is not allowed! See the tracestack for more information!
I got this error after added it in page ? this is my code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using umbraco.cms.businesslogic.member ;
namespace umbracoUsercontrols
{
public partial class mySignUPUserControl : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e)
{
TextBox ttitle = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("txttitle");
TextBox tfirstName = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("txtfirstname");
TextBox tlastName = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("txtlastname");
TextBox tfullName = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("txtfullname");
TextBox taddressline1 = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("txtAddressline1");
TextBox taddressline2 = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("txtAddressline2");
TextBox tcity = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("txtcity");
TextBox tcounty = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("txtcounty");
TextBox tpostcode = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("txtpotcode");
TextBox tphone = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("txtTelephone");
TextBox tfax = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("txtfax");
TextBox temail = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("txtemail");
TextBox tcompany = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("txtcompany");
TextBox tpassword = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("txtpassword");
TextBox tusername = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("txtusername");
TextBox tcountry = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("txtcountry");
CheckBox subscribeCheckBox = (CheckBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("SubscribeCheckBox");
if (UserExists(tusername.Text) && UserExistsforEmail (temail .Text ) )
{
Literal err = (Literal)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("ErrorMessage");
err.Text = "User name or Email already registered";
}
else
{
MemberType dt = MemberType.GetByAlias("Standard");
// MemberGroup mg = MemberGroup.GetByName("Member Group");
Member m = Member.MakeNew(tfullName.Text, dt, new umbraco.BusinessLogic.User(0));
m.Password = tpassword.Text;
m.Email = temail.Text;
m.LoginName = tusername.Text;
//m.AddGroup(mg.Id);
m.getProperty("firstName").Value = tfirstName.Text;
m.getProperty("lastName").Value = tlastName.Text;
m.getProperty("phone").Value = tphone.Text;
m.getProperty("title").Value = ttitle.Text;
m.getProperty("company").Value = tcompany.Text;
m.getProperty("addressLine1").Value = taddressline1.Text;
m.getProperty("addressLine2").Value = taddressline2.Text;
m.getProperty("city").Value = tcity.Text;
m.getProperty("county").Value = tcounty.Text;
m.getProperty("postCode").Value = tpostcode.Text;
m.getProperty("fax").Value = tfax.Text;
m.getProperty("fullName").Value = tfullName.Text;
m.getProperty("country").Value = tcountry.Text;
if (subscribeCheckBox.Checked == true)
{
m.getProperty("subscribeNewsLetter").Value = true;
}
else
{
m.getProperty("subscribeNewsLetter").Value = false;
}
m.XmlGenerate(new System.Xml.XmlDocument());
m.Save();
}
}
private bool UserExists(string username)
{
if (Member.IsMember(username) == true) { return true; }
return false;
}
private bool UserExistsforEmail(string emailadd)
{
String m = System.Web.Security.Membership.GetUserNameByEmail(emailadd);
if (String.IsNullOrEmpty (m) ){ return false; }
return true;
}
}
}
Hi Pat
When you have made your build are you then sure you have remembered to copy both the generated .dll and user control over in the proper folders in your installation?
/Jan
yes both loaded, now I can see the sign up page and when I try create new member it gives error No member with loginname: ABCD1234
I have change my code
private bool UserExists(string username)
{
if (System.Web.Security.Membership.GetUser (username) != null) { return true; }
return false;
}
private bool UserExistsforEmail(string emailadd)
{
String m = System.Web.Security.Membership.GetUserNameByEmail(emailadd);
if (String.IsNullOrEmpty (m) ){ return false; }
return true;
}
is working on a reply...