Not long ago someone asked in the Forums about a hook point so he could run some custom logic whenever a new page was created. As I recall he wanted to put some default content starter onto each new page to make it easy for his user to just click edit instead of having to add a feature instance to the page. He was going to customize the mojoPortal code and of course I always recommend against doing this, because as soon as you fork the code you make it very difficult to ever upgrade your mojoPortal installation. Its always best if your custom code can be in external projects, so I implemeted a provider model to allow you to plugin your own custom handler from your own external project.
To create your handler, you can copy this "DoNothing" handler and change the class name and namespace and add in your implementation logic.
public class DoNothingPageCreatedEventHandler : PageCreatedEventHandlerPovider
private static readonly ILog log = LogManager.GetLogger(typeof(DoNothingPageCreatedEventHandler));
public override void PageCreatedHandler(object sender, PageCreatedEventArgs e)
if (sender == null)
PageSettings page = sender as PageSettings;
// do nothing
log.Debug("DoNothingPageCreatedEventHandler handled PageCreated event for " + page.PageName);
Next you have to create a config file so that mojoPortal knows about your handler. I recommend you create the config file in your external project and use a post build event to copy it to the Web project where it is needed. It should go in your UI project (if you have 3 tiers), under /Setup/ProviderConfig/pagecreatedeventhandlers, and your post build event should copy it from there to Web/Setup/ProviderConfig/pagecreatedeventhandlers
The syntax for the config file is very simple:
<?xml version="1.0" encoding="utf-8" ?>
description="your description here"
YourCustomAssemblyName is the name of the dll containing your custom class, but without the .dll extension.