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 (e == null) return;
            if (e.SiteUser == null) return;
            // do nothing
            log.Debug("DoNothingUserRegisteredHandler called for new user " + e.SiteUser.Email);
        }
    }
}

You 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. Its recommended to 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

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>

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

Last Modified by Joe Davis on Jun 20, 2023