This is part one of a new blog series about setting up a social community with the free DNN platform. I have been presenting about that at this year’s #DNNCon in West Palm Beach, FL and I thought it’s best to write down in detail what I found was a good way in setting up a site like this.
In part one we will have a look at how to setup a login and registration page to let visitors access your site.
Future parts will cover the setup of profile pages, group pages, discussion forums and membership directories. I will update this post to include links once new posts go online.
Login / Registration
The page that your visitors will use to get access to secured content is a crucial page within your website. I call that page a VIP, a very important page, since on that page you can either let visitors easily gain access to your secured content or – when it comes worst - scare them away.
From other bigger sites on the internet we know that it is preferable to have login and registration forms available on the same site, without the need of having the user switch back and forth between different pages – at least not without back links.
Unfortunately with current versions of DNN it is not possible to have a login module together with an account registration module on the same page without doing a bit of ascx files hacking. (you will basically need to set CausesValidation=”false” on the LinkButtons in both modules)
Fig 1: both forms – login & registration on the same page. While that is visually appealing and helpful to the visitor, it is not possible.
The workaround is to either create two different pages with a layout like on the screenshots left. You basically mimic a single page layout.
Alternatively you can of course make use of third party modules that are not affected by that behavior.
Feel free to give the DNN-Connect account registration module a try. That module allows for both forms on one page.
That module renders its forms through templates, providing you with the ultimate flexibility, which is another improvement that DNN is yet lacking.
Either way it is advisable to ask not too many profile properties in the registration form. As I said, it must be dead simple to gain access to your site. Once someone is registered successfully and has accessed the site you can still ask for a completed profile or even make that mandatory.
You can customize the way the registration form looks like in Admin > Site Settings > User Registration
Once this is set to Custom, you can type in Properties to ask for in the form and they will show up in the order you have added them here. The above together with a Display Name Format set to [FIRSTNAME] [LASTNAME] gives you as less form fields as possible and therefore the type of form that you have been looking for.
You may also want to consider providing authentication facilities for third party sites like Google, Facebook, Twitter or Live. All these four providers are available in the DNN platform core distribution. Please try those providers first in a development environment. They may or may not work for your use case and they may create user accounts in a format that not necessarily matches your needs.
Here is – in short –what you need to do in order to use social logins.
1. Go to the developer platforms of the site that you want to utilize the authentication (see bottom of this post for links)
2. Create an app and / or request API keys and / or API secrets
(Naming differs between the different platforms, in general you need some sort of security token that authorizes the provider)
3. If the providers have not been installed already go to Host > Extensions > Available Extensions > Authentication systems and install the providers that you need.
4. Once installed go to Admin > Extensions > Authentication Systems and configure each provider by clicking on EDIT next to the provider.
5. Once the provider is enabled, a corresponding button should appear in the login form.
My personal fly in the ointment with the current providers is that they don’t check if an account for a given e-mail address exists already, i.e. they will create new accounts in all cases and prefix the username with the authentication method, e.g. “facebook-“
I hope to get this behavior changed for one of the next DNN versions.
The last step once everything is done, will be to set a few more settings in Site settings > User Account Settings.
a) Redirect After Login – most likely point to a community entry page or the profile page of the current account
b) Redirect After Logout - whatever you feel is right. Must be visible to non-authenticated users obviously
c) Redirect after Registration – again most likely to a community entry page. Or, alternatively to the profile page so the user can finalize his profile data.
Additional consideration is needed for the Registration Mode overall. The most open mode and therefore many times the mode of choice in social communities will be “Public”, where the user is registered and authenticated right away with no further validation.
Once set to “Verified” you can at least make sure, that the user has a valid email address that he has access to. Of course this adds another hurdle to the whole process. Sometimes those verification emails take forever to arrive and the user is gone already and will not come back again anytime soon.
It all depends on your situation and there is no best practice guide for choosing the right setting here unfortunately.
Note that DNN will send emails to the user account registering on your site during the registration process. The content of those emails is template driven and I cannot often enough keep telling people to customize those emails. It is the first email they get from you once they register on the site and you will certainly not leave them with that crappy plain text message that is being shipped with the platform.
You will find the templates in Admin > Languages > Global Resources for each of your portal languages. Do not attempt to edit the system resources as those will be overwritten with each upgrade. Either alter the host resources for system wide changes or the portal resources for portal specific customizations.
The resource key fields to watch out for are:
EMAIL_USER_REGISTRATION_PRIVATE_BODY, EMAIL_USER_REGISTRATION_PUBLIC_BODY, EMAIL_USER_REGISTRATION_VERIFIED_BODY
Each of them refers to one registration mode, so make sure you change the one that matches your mode.
Formatting email templates is straightforward if you know how to code html. It’s even easier once you have been around for a while, because email clients do not know much about css3 and all those modern web technologies. HTML coding an email is pretty much the same than coding a table based website back in the 90’s.
A good guide to writing HTML emails may be found here:
Tokens that you can use within those emails can be found in the dnnsoftware.com wiki pages
Developer sites to gain API tokens for social logins:
This post is cross posted from my personal blog on dnn-connect.org