September 2006
How to ensure a user agrees to the terms and conditions of your website while they register.
Before you start to read this I would like to thank Brian Andrews for his tips on this issue and Charles Nurse for making my brain start to work again. I have been running around in circles for weeks over this issue and finally I have got this working.
- Choose 'User Accounts' from the Admin menu.
- Choose Manage Profile Profile Properties. If you are used to DNN 4.0.2 or 3.2.2 this may look a lot different. The new profile options in DNN 4.3.3 was Charles Nurse's work..thanks Charles for such an excellent job!
- From the bottom of the page choose Add New Profile Property.
- The arrows show you what to fill in.
- The Property Name. We choose AcceptTerms. It is important that you use the same name because we are going to use that in our resx files to localize it.
- Data Type. We choose TrueFalse because we want a Checkbox to appear in the Users Profile Page
- If you choose to use a Property Category the Accept Terms checkbox will be placed in its own category on your Profile Page which seems appropriate to me. We name the new category 'Accept the Terms of this site".
- Validation Expression. We want users to check the checkbox and accept the Terms and Conditions of the site. Therefore we 'validate' the value using a validation expression with the value True. If it is not checked the user will get a warning but more about this later.
- Required. We want this field to be Required, the user has to accept the checkbox.
- Visible. If we don't make it visible it is not much use to us :-)
Note from the editor: Validation Expression: should be used for checking that the data entered is in the correct format. You can provide a regular expression to validate the data against (only valid for Text data types). For instance [\w\.-]+(\+[\w-]*)?@([\w-]+\.)+[\w-]+ can be used to enforce a valid email address (somename@somesite.something).
For further information, simply Google ‘Validation Expressions’ or ‘Regular Expressions’.
The example provided here is to demonstrate how you would implement the text to display if the data entered is not valid. – In the case of a checkbox, you do not need to enter a validation expression, you only need to tick the ‘Required’ checkbox to ensure that a user has to tick the checkbox before they can register.
- Now we have to edit the resx file and add the appropriate ProfileProperties values to it so that we can localize it. The resx file we need to edit can be found in the folder \admin\Users\App_LocalResources\Profile.ascx.resx. We need to add the following ProfileProperties:
<data name="ProfileProperties_AcceptTerms.Text">
<value>You must accept the Terms</value>
</data>
<data name="ProfileProperties_AcceptTerms.Required">
<value>You must accept the Terms</value>
</data>
<data name="ProfileProperties_AcceptTerms.Validation">
<value>You must accept the Terms</value>
</data>
<data name="ProfileProperties_AcceptTerms.Help">
<value>You must check the checkbox in order to accept the Terms of this site</value>
</data>
I just added them to the bottom of that file. It does not really matter where you place them.
- Now we are going to use the Language Editor to adjust the text we added in the Profile.ascx.resx file. As you can see in the above sample we have added 'Accept the Terms.' We will now modify 'Accept the Terms of this site' so that the word 'Terms' will be a link to the terms of the site. We will also open the link in a new window because it is kind of annoying when the user is taken away from the page he/she is on. Choose languages from the Host menu or the Admin menu. For more information about localizing Dotnetnuke have a look at Vicenç Masanas blog.
- Choose Language Editor
- Bingo! There we have the ProfileProperties values we added to the Profile.ascx.resx file.
- I would like to change the text in ProfileProperties_AcceptTerms.Text so that it is clearer what those Terms are. So, I made the word 'Terms' clickable and it opens in a new window. In the screenshot you can see how I did that.
Well, this is almost done but we want to see how the Registration screen looks. That depends a bit on how you set your User Settings. We choose to force a valid Profile by checking 'Require a valid profile for Registration'. What this means is that the user must complete all fields on initial registration. If you uncheck that setting the user is prompted for those required fields the first time he logs on to the site. Voila, there is our 'Accept the Terms of this site' Check box.
And this is what the user will see if he does not check that checkbox
If you have set cookie expiration to a very long time in the web.config file, users will stay logged in and will not be forced to update their profile before the cookie has expired. The easiest way to fix this is to change the default name of the cookie (.DOTNETNUKE) to something else. That will render all cookies useless and the user has to login to the site and will be forced to update their profile.
Mariette Knap is a Microsoft MVP who operates server-essentials.com
Numerous articles, how to's and links to other websites assist you in installing and maintaining Smallbusiness Server 2000 and 2003. There is a discussion forum where you can post questions, we will try to answer asap. The content that you will see on this site is different if you are logged in as Registered User. Registration on server-essentials.com is free of charge.
Recommended
We recommend that you now view these 6 video tutorials which explain how to set up the Term and Conditions check box for the registration page as well as further formatting and styling options within the registration page such as using lists and the rich text editor:
How to Create a Custom Registration Page Using Manage Profile Properties