How to Implement a DotNetNuke User Registration Module Using DotNetMushroom RAD

By Luke Rocco & Justin Mifsud
July 2010

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
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
Screenshot of the Add New User dialog 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
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
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
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.

Comments

comments or questionsIf you have any comments for this tutorial, please ask them in this DNM RAD User Registration forum thread.

Downloads

 TitleOwnerCategory 
DNM RAD Register User CodeAndy Stephenson DNN CreativeUSA S3 ServerDownload
DNM RAD Register User CodeAndy Stephenson DNN CreativeUK Server2Download

Recommended Tutorials:

R2i Open Web Studio (OWS) Module:
'How to Build a Public Knowledge Base with OWS'
How to Import the Configuration Source Code into Open Web Studio
An Introduction to R2i Open Web Studio – Part 1
How to Build Module Interfaces in Open Web Studio – Part 2
The User Search Interface in Open Web Studio - Part 3
Personalization, Text Editor, Logging and Reporting in Open Web Studio - Part 4
Debugging, Enhanced Reporting, Importing Records and Scheduling - Part 5
Making it Cool - Creating a Mashup - Part 6 of 6
How to Create an Email Form with OWS
How to Create an iPhone App with OWS
How to Create a Portal Signup Module with OWS
How to Create a Custom Login and Register Module with OWS
Working with File Action in Open Web Studio
Enhancing the OWS Login Module and Building a Twitter Module
Form Validation, Dependant Drop Downs and Data Level Security in OWS
How to Create an Installable DotNetNuke PA Module Using OWS
How to Create a Skin Object from an OWS Configuration
OWS Advanced Techniques: User Access and Security
Getting Started With jQuery UI in OWS

DotNetMushroom (DNM) Rapid Application Developer (RAD)
How to Build a News Application with DotNetMushroom RAD
How to Style a News Application Built with DotNetMushroom RAD
How to Implement Multi-Language Localization With DotNetMushroom RAD
Language Resource Files in DotNetMushroom RAD Applications
How to Implement Paging with DotNetMushroom RAD
How to Implement a News Carousel Using DotNetMushroom RAD and JQuery
New Features in DNM 01.20.00
How to Implement a DotNetNuke User Registration Module Using DNM RAD
Creating Charts Using DNM RAD 1.3 for DotNetNuke
Creating an Events Calendar for DotNetNuke using DotNetMushroom RAD
Working with Lists in DotNetMushroom RAD
Making use of the jsTree Control in DotNetMushroom RAD

Ifinity:
URL Master Module

OnyakTech:
SigmaLive Module
OnyakTech Host Commander Module

DNN Stuff:
Aggregator Module
Module Rotator

Markit Modules:
Slideshow Module
PageEar Module

Codeplex:
Monitter4DNN Twitter Module

Oliver Hine:
Advanced Optimized Control Panel

Maps:
GeoSprawl DotNetNuke Locator Module
ZLDNN Advanced Biz Map For DotNetNuke

Evotiva:
DNNBackup Module

Smith Consulting:
DotNetNuke Smith Shopping Cart

InteractiveWebs:
InteractiveWebs Advanced Login Module
You are not logged in.
You must log in to access all 
650+ videos, tutorials, podcasts, and more.
RSS Feeds