Maybe you have some logic you would like to execute whenever a new user registers. I've implemented a provider model to allow you to plug in handlers so you don't have to modify anything in the core of mojoPortal to accomplish your task. You should always avoid making any customizations to the core of mojoPortal to ensure you will have s mooth upgrade path going forward. You can create your handlers in your own projects external to mojoPortal projects.

An example might be that you want to implement some welcome email that you send to new users

To create your own User Registered Event Handler, copy this one, change the class name and namespace and add your custom logic:

using System;
using System.Configuration.Provider;
using System.Collections.Generic;
using System.Text;
using mojoPortal.Business;
using log4net;

namespace mojoPortal.Business.WebHelpers.UserRegisteredHandlers
{

public class DoNothingUserRegisteredHandler : UserRegisteredHandlerProvider
{
private static readonly ILog log
= LogManager.GetLogger(typeof(DoNothingUserRegisteredHandler));

public DoNothingUserRegisteredHandler()
{ }

public override void UserRegisteredHandler(object sender, UserRegisteredEventArgs e)
{
//if (sender == null) return;
if (e == null) return;
if (e.SiteUser == null) return;

// do nothing
log.Debug("DoNothingUserRegisteredHandler called for new user " + e.SiteUser.Email);
}
}
}

Now you still have to plug it in so mojoPortal knows about it. Typically, in your external projects you will have a post build event to copy your dlls to the Web/bin. You must also create a config file. You should keep it in your own project (usually the UI project if you have 3 tiers) under /Setup/ProviderConfig/userregisteredhandlers/ and add a step to your post build event that will copy it to /Web/Setup/ProviderConfig/userregisteredhandlers

So your file might be named mycustomuserregisteredhandler.config. the syntax for the content of this file is very simple:

<?xml version="1.0" encoding="utf-8" ?>
<UserRegisteredEventHandlers>
<providers>
<add name="YourCustomClassName"
type="YourCustomNamespace.YourCustomClassName, YourAssemblyName"
description="your description" />

</providers>
</UserRegisteredEventHandlers>

Note that YourAssemblyName is the name of the dll containing your handler but without the .dll extension

Last Modified by Joe Audette on Aug 16, 2008