web design malta, dnn, dotnetnuke, website design, seo

Follow DotNetMushroom on TwitterFollow DotNetMushroom on LinkedIN
 

Search

Author Title  
Search by Blog Author / Keywords from above tabs or search by Blog Tags by selecting the respective tag below

Blog TagsSelect to Filter Entries

Entries Filtered byDNM

DotNetMushroom Blog

 

All Blog including side menu filters were {Built with DNM RAD}

Loading ...
03/07/2010
Implement a DotNetNuke User Registration Module Using DNM RAD
Posted By:Vella Fiona/Tags:PANELTAGS

In this tutorial we show you how to create a user registration module using DotNetMushroom RAD (DNM RAD).

We walk you through how to create a form using DNM RAD in which the user will provide his First Name, Last Name, Display Name, Username and E-Mail. The form will insert these user credentials into the DotNetNuke Users table. Optionally, a copy of these credentials can also be saved in a DotNetMushroom table.

For this tutorial, you will need a version of DotNetMushroom RAD. Version 1.1 is available as a free trial or you can purchase version 1.2 here

Step 1: Create a Default User Account in DotNetNuke

To implement the Multi-Language feature of the DotNetMushroom RAD Module, the Languages’ Locales need to be added from the DotNetNuke Host Menu under the Languages section.

1.1) Go to Admin > User Accounts

Screenshot of Admin > User Accounts

1.2) Click on Add New User

1.3) From the fields that need to be filled in, the most important are the User Name and the Password.

For our example, we have chosen:

User Name: Dummy
Password: DefPassword

Screenshot of the Add New User after performing Step 1.3

1.4) Press Add New User

Step 2: Run the SQL Script to Create and Register a User with DNN

The following SQL Script was written by Mitchel Sellers and can be found in the article Creating a Standard DotNetNuke User Via SQL.

2.1) Go to Host > SQL

2.2) Copy the following script and paste it in the text box. Alternatively you can save the file that comes with this article and load it via the Browse button. The SQL script is the following:

/*
THE FOLLOWING STORED PROCEDURE CAN BE USED TO CREATE AND REGISTER A USER WITH DNN. IN ORDER TO WORK, THIS PROCEDURE NEEDS TO HAVE A DEFAULT USER ACCOUNT FROM WHICH TO COPY THE PASSWORD DETAILS.
*/

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE spr_dnm_RegisterUser

--@RootUser nvarchar ( 256 ),
@FirstName nvarchar (256),
@LastName nvarchar (256),
@DisplayName nvarchar (256),
@UserName nvarchar(256) ,
@Email nvarchar(256)

/*
@Password nvarchar(128), --From the existing user
@PasswordSalt nvarchar(128), --From the existing user
@PasswordFormat int, --From the existing user
@PortalId int, --From the existing data
*/

/*
@ApplicationName nvarchar(256) = 'DotNetNuke',
@PasswordQuestion nvarchar(256) = '',
@PasswordAnswer nvarchar(128) = '',
@IsApproved bit = 1,
@CurrentTimeUtc datetime = NULL,
@CreateDate datetime = NULL,
@UniqueEmail int = 0
*/

AS
BEGIN

DECLARE @RootUser nvarchar (15) = 'dummy'

DECLARE @ApplicationName nvarchar(256) = 'DotNetNuke'
DECLARE @PasswordQuestion nvarchar(256) = ''
DECLARE @PasswordAnswer nvarchar(128) = ''
DECLARE @IsApproved bit = 1
DECLARE @CurrentTimeUtc datetime = NULL
DECLARE @CreateDate datetime = NULL
DECLARE @UniqueEmail int = 0

/*
SET @ApplicationName = 'DotNetNuke'
SET @PasswordQuestion = ''
SET @PasswordAnswer = ''
SET @IsApproved = 1
SET @CurrentTimeUtc = NULL
SET @CreateDate = NULL
SET @UniqueEmail = 0
*/

SET NOCOUNT ON;

DECLARE @UserId uniqueidentifier
DECLARE @DNNUserId int

DECLARE @Password nvarchar(128) --From the existing user
DECLARE @PasswordSalt nvarchar(128) --From the existing user
DECLARE @PasswordFormat nvarchar(256) --From the existing user
DECLARE @PortalId int -- From the existing data

IF ( @CurrentTimeUtc IS NULL ) SET @CurrentTimeUtc = GETDATE()
IF ( @CreateDate IS NULL ) SET @CreateDate = GETDATE()

SELECT @Password = m.password, @PasswordSalt = m.passwordsalt, @PasswordFormat = m.passwordformat
FROM aspnet_users u INNER JOIN aspnet_membership m ON (u.userid = m.userid)
WHERE u.UserName = @RootUser

SELECT @PortalId = PortalID--,PortalName
FROM Portals

--Make the stored procedure call
EXEC dbo.aspnet_Membership_CreateUser @ApplicationName, @Username, @Password,
@PasswordSalt, @email, @passwordquestion, @PasswordAnswer,
@IsApproved, @CurrentTimeUtc, @CreateDate, @UniqueEmail,
@PasswordFormat, @UserId

--Insert the record into the DotNetNuke users table
INSERT INTO users ( Username, FirstName, LastName, IsSuperUser, Email, DisplayName, UpdatePassword )
VALUES ( @Username, @FirstName, @LastName, 0, @Email, @DisplayName, 1 )

--Get the new userid, from the DNN users table
SELECT @dnnuserid = userid
FROM Users WHERE username = @Username

--Now, insert the record into the user portals table
INSERT INTO UserPortals (userId, PortalId, CreatedDate)
VALUES(@dnnuserid, @PortalId, GETDATE())

--Now Give the user permissions to the RECISTERED Users group
INSERT INTO UserRoles (userId, roleId)
SELECT @dnnuserid, roleId
FROM Roles
WHERE RoleName = 'Registered Users'

END
GO

2.3) Change the value of @RootUser variable to the default user name created in Part 1.3.

2.4) Check the Run as Script checkbox and press Execute

Screenshot showing the DNN Host > Script form

Step 3: Create a RegisterUser Table in DNM RAD

3.1) Open DNM RAD and from the Control Panel select Tables

3.2) Click on New Table

3.3) Choose a name for the table. In this example we will call it tb_RegisterUser

3.4) Click on Create New Field and assign the following field properties:

Field Name – Username
Field Type – Text
Field Caption – Username
Field Size – 255
Field Order – 10

Screenshot showing the field properties assigned in Step3.4

3.5) Create the fields FirstName, LastName, DisplayName and E-mail and assign them the same properties as Step 3.4 (the only differences being the Field Name and Field Caption which should be the same as the name of the field being created e.g. FirstName, LastName etc.)

Step 4: Create a RegisterUser Form in DNM RAD

4.1) Go to the Control Panel and select Forms

4.2) Click on New Form

4.3) Choose a name for the table. In this example we will call it frm_RegisterUser

4.4) Under Form Data, set Data Source to the RegisterUser Table (tb_RegisterUser)

4.5) The form should now have the following text boxes: Username, FirstName, LastName, DisplayName and E-Mail

4.6) Add a button

4.7) Set its Button Event to “Call Stored Procedure”

4.8) Change the Stored Procedure Properties’ Name to the name of the Stored Procedure created in Step 2

4.9) Set the Parameters of the Stored Procedure to:

@FirstName={FirstName},@LastName={LastName},@DisplayName={DisplayName},@UserName={UserName},@Email={Email}

Screenshot showing the form properties

Step 5: Deploy the Form and You’re Ready!

Deploy the Form that has just been created by:

5.1) Go to the page where you want to insert your register module

5.2) Select DotNetMushroom RAD from the Module dropdown menu in the DotNetNuke Control Panel

5.3) Select the Pane where you want to deploy it (e.g. ContentPane)

5.4) Name the module instance e.g. Registration

5.5) Press the Add Button

5.6) Select the blue DNN arrow and head to Settings

5.7) Go to DNM Settings

5.8) Choose the Application Name from the dropdown

5.9) Choose the form name from the second dropdown

5.10) Press Update

Your DNN Registration module is now ready!

If you have any problems working with the DNM RAD module you can visit the DotNetMushroom Forums.

Download the DNM Register User Code

DotNetMushroom offers
DotNetNuke © (DNN) based web
design in Malta and Worldwide
Copyright (c) 2008 - 2012

Holistic IT Group

web design malta, dnn, dotnetnuke, website design, seo