help.axcms.netAxinom Logo
Save Save Chapter Send Feedback

Creating Members

This article describes how to add a new member in live-system.

Creating the Template

First you need to create a Template for registration. Add a reference to the assembly AxCMS.BL.dll. Put some Textboxes on the template for username, password, email, firstname and name. Add a button and use following code in button-click method:

using Axinom.AECMS.UserManagement;

...

if (System.ConfigurationSetting.AppSettings["IsAxCMS"] == "0")
{
_userAdapter = new AxUserAdapter();
AxUser user = new AxUser();

user.FirstName = _firstNameTextBox.Text.Trim();
user.Name = _nameTextBox.Text.Trim();
user.EMail = _emailTextBox.Text;
user.Password = _passwordTextBox.Text;
user.HomeSystem = Systems.LiveSystem;
user = _userAdapter.SaveUser(user);
}


Description

The If-Condition is necessary for checking that this code is only executed if the template is accessed in Live-System. If the LiveSystem check would not be there and editor clicks the button in Management System - an user would be created who's able to login to cms.

The AxUserDataAgent is the class needed to save and load users from DB. the AxUser-Class is the class for the member which you want to create. It has many properties. In this example only the most important Properties are shown.