The NewUserDefault CSModule of the Alabaster package
A few weeks ago, the Community Server MVP's released a package of CSModule's, which we called Alabaster. It contained a couple of CSModule's developed by a couple of us MVP's. My contribution to Alabaster was a module called NewUserDefaults, which I like to talk a little bit more about in today's post.
The thing that got me thinking about developing this CSModule, was that CS lacked the possibility to enable notification for newly registered users. When a new user registered, this setting defaults to off. People not used with CS, together with those not that tech savvy, could in my opinion have a hard time finding that setting. Also I believe in many other forums systems this is usually set to on, so they might be used by that.
So why should that be a problem? Well, IMO, in a scenario where a new users registers on your site just to ask a question, he or she may never know if there ever was an answer, they may forget that they ever visited your site, and you loose a potential new active user to your community.
There were also a couple of other settings I found was not configurable by an admin to what their defaults should be, which I thought I add to the module.
To install the module, together with all the others in the package (they are all in one single DLL), just copy the DLL to your BIN folder. To activate the NewUserDefault module you need to add a couple of lines to your communityserver.config file. The lines you add should go into the <CSModules> section, which you'll find near the end of the communityserver.config.
The following is an example on what you could put there:
<add name = "NewUserDefaults"
type = "CSMVPs.CSModule's.JOEriksson.UserDefaults, CSMVPs.CSModules" >
<EnableNotifications Value="True" />
<EnableAvatar Value="True" />
<EnableCollapsingPanels Value="True" />
<EnableInk Value="True" />
<EnableDisplayInMemberList Value="True" />
<EnableDisplayName Value="True" />
<EnableHtmlEmail Value="True" />
<EnableOnlineStatus Value="True" />
<EnablePrivateMessages Value="True" />
<EnableUserSignatures Value="True" />
</add>
Now you might not need each of the lines above. The settings you don't want to change from their defaults behavior can be omitted. So if you just wanted to set the notifications to ON, it would look like this:
<add name = "NewUserDefaults"
type = "CSMVPs.CSModules.JOEriksson.UserDefaults, CSMVPs.CSModules" >
<EnableNotifications Value="True" />
</add>
The code will just look for those rows that are present between the 'add' tags, and ignore any action on those settings that have no rows in the communityserver.config.
After you modify the communityserver.config you need to 'touch' (open and save it) the web.config file so all settings goes through.
That's all you have to do. The next time a user registers, the default settings you've set here should take effect.
The module triggers whenever a user is updated. It then checks if it is a new user that is created.
Private Sub csa_PostUserUpdate(ByVal user As User, ByVal e As CSEventArgs)
If e.State <> ObjectState.Create Then
Return
End If
SetUserDefaults(user)
End Sub
If it is, it goes through what you have set in your communityserver.config, and sets those settings on the current user object.
Private Sub SetUserDefaults(ByVal user As User)
If Me._EnableNotifications <> "" Then
user.EnableThreadTracking = (Me._EnableNotifications)
End If
.
.
.
End Sub
I've omitted the rest of the IF statements in the code sample above to make it easier to read here in the post. And I know, I should probably not have been using a series of IF statements, but some SELECT CASE block instead, but couldn't figure out how, since even if one of the settings is there, I need it to check the others as well.
Well, there it is, download and use it if you have the needs to set any of these settings for new users.
If you enjoyed this post Subscribe to my feed via RSS or e-mail!