mojoPortal Content Management System has a plugin model that allows you to plugin custom code that canbe executed when a new site is created.

To create your handler, you can copy this "DoNothing" handler and change the class name and namespace and add in your implementation logic.

using log4net;

namespace mojoPortal.Business.WebHelpers.SiteCreatedEventHandlers
{
public class DoNothingSiteCreatedEventHandler : SiteCreatedEventHandlerProvider
{
private static readonly ILog log
= LogManager.GetLogger(typeof(DoNothingSiteCreatedEventHandler));

public DoNothingSiteCreatedEventHandler()
{ }

public override void SiteCreatedHandler(object sender, SiteCreatedEventArgs e)
{
if (e.Site == null) { return; }
//if (sender == null) return;

// do nothing
log.Debug("DoNothingSiteCreatedEventHandler handled SiteCreated event for " + e.Site.SiteName);
}
}

}

To plug in your custom handler you create an xml file in the following format and drop it into the folder at
/Setup/ProviderConfig/sitecreatedeventhandlers

<?xml version="1.0" encoding="utf-8" ?>
<SiteCreatedEventHandlers>
<providers>
<add name="DoNothingSiteCreatedEventHandler"
type="yournamespace.yourhandlerclass, yourassemblyname"
description="Your description" />
</providers>
</SiteCreatedEventHandlers>

Your Site Created Event Handler should go in your own class library (or your own Web UI project), you declare you namespace and class in the config file, the assembly name is the name of your dll but without the file extension.

 

Last Modified by Joe Audette on Oct 30, 2012