CSModule for New account defaults and email notification
Introduction:
This module is used to set some default values for profiles and also email the system administrators when accounts are created. Source is included but I have a precompiled DLL in the zip for those that don’t have the tools to compile the module on their own.
The Update User Profile module performs the following tasks:
-
When a new account is created profile settings from the Anonymous user account are copied to the new account
-
An email is sent to the members of the system administrator role, if enabled
The role that is used is set in the CommunityServer.config file as is the flag that allows the email to be sent. If a member of the site is just making a profile update then nothing happens. I was interested in knowing when an account is created and forcing some non-default settings to be put in place.
The mail that is sent is pretty basic and to the point. Perhaps in an update the email should come from the templates but this will do for a version 1 and this was also a learning experience to figure out how to get my environment setup and create modules.
Getting setup:
-
Create a directory to hold the source code and VS2005 project file
-
Place the RpgJunkie.CsModules.UpdateUserProfile.csproj and UpdateUserProfile.cs into the new directory
-
Open the csproj file with Visual Studio 2005
-
Once in Visual Studio, Change the build directory to match your CS2007 Bin folder
-
Check the references for the CS DLLs since the path might not be the same as mine
-
Build the project
Settings:
NotificationGroup - This is the Role whos members will receive an emaiil each time a new account is created
EmailEnabled - Set this to 'true' to send email notifications to the NotificationGroup above
Configuration Additions:
You will need to add the following to the Modules section of the CommunityServer.config:
<add name = "NewUserUpdates" type = "RpgJunkie.CsModules.UpdateUserProfile, RpgJunkie.CsModules.UpdateUserProfile">
<NotificationGroup>SystemAdministrator</NotificationGroup>
<EmailEnabled>true</EmailEnabled>
</add>
You can download the zip with the source here.