Hi femi,
I implemented a solution today to make this easy for you. Its only in my svn sandbox at the moment and I have other things I'mnot ready to merge to trunk yet, but I will get this into trunk over the weekend.
Basically there is an event fired when a user registers and now I have implemented a provider model for handlers of this event so you can plug your custom handler in with a config file and implement it in your own custom project. An example implementation that doesn't do anything is like this:
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 (e == null) return;
if (e.SiteUser == null) return;
// do nothing
log.Debug("DoNothingUserRegisteredHandler called for new user " + e.SiteUser.Email);
}
}
}
You would have yours in your own namespace but you inherit from mojoPortal.Business.WebHelpers.UserRegisteredHandlers.UserRegisteredHandlerProvider
Config files go in /Setup/ProviderConfig/userregisteredhandlers
Its just a text file with .config extenstion like this:
<?xml version="1.0" encoding="utf-8" ?>
<UserRegisteredEventHandlers>
<providers>
<add name="DoNothingUserRegisteredHandler"
type="mojoPortal.Business.WebHelpers.UserRegisteredHandlers.DoNothingUserRegisteredHandler, mojoPortal.Business.WebHelpers"
description="This is a placeholder, do not delete this one. There must always be at least on provider in the collection. " />
</providers>
</UserRegisteredEventHandlers>
Hope you get the idea from this code example.
Like I said, its not in svn trunk yet but will be in there over the weekend and then you will be able to implement your code.
Best,
Joe