Optionally provide private feedback to help us improve this article...

Thank you for your feedback!

How InstantForum Plug-Ins Work

A plug-in within InstantForum is essentially a single DLL file (containing your plug-in code and any compiled resources)  and any number of user controls (or .ascx) files containing your plug-in HTML or mark-up.You can also include optional CSS and JavaScript within plug-ins however to keep things portal we would suggest developing these as embedded resources.

As plug-ins are standard ASP.NET user controls injected into InstantForum at run-time  you can use server controls within plug-ins (labels, links, grid views, login controls, 3rd party components etc.).  You can also programmatically set-up controls from your plug-ins code-behind.

To register a plug-in with InstantForum you'll need to add an entry for your plug-in to the <PlugIns> section within the InstantForum web.config file.  To see a sample plug-in please take a look at our Hello World example.

To get started creating plug-ins please see our Visual Studio download below.

Which Class Should My Plug-In Inherit From?

To create a InstantForum plug-in from a user control you'll need to ensure the code-behind for your user control inherits from our InstantASP.Common.UI.Base.Plugin or InstantASP.InstantForum.UI.Base.Plugin class.

The  InstantASP.Common.UI.Base.Plugin base class derives from System.Web.UI.UserControl however it provides additional functionality to load your plug-ins control at run-time and inject your plug-in into the pages control collection.

If you would like to access the HttpContext object exposed by InstantForum you should inherit from the forum specific plug-in base class located at InstantASP.InstantForum.UI.Base.Plugin. The InstantASP.InstantForum.UI.Base.Pluginclass inherits from InstantASP.InstantForum.UI.Base.Plugin however it exposes a "CurrentContext" property allowing you to get forum specific data.

Which Interface Should My Plug-In Implement?

To allow your plug-in to modify the containing page (for example add CSS or custom JavaScript or modify the containing pages control collection) you'll need to implement the InstantASP.Common.Plugins.IPagePlugin interface.

This interface provide four key events (OnPluginInit, OnPluginLoad, OnPluginPreRender, OnPluginRender) which allow you manipulate the page containing your plug-in at each of these four events.

Our plug-in framework within InstantForum will always add your plug-in user control to the end of the pages control collection. Just before the very end form tag. You can inject plug-ins into specific locations within mark-up by using a Response.Filter or simply adding your plug-in to the pages control collection at the correct position.

How is InstantForum aware of my plug-in?

To ensure InstantForum uses your plug-in you'll need to add an entry to the web.config file.

Can i download an example Visual Studio project?

Yes. To help we've put together a Visual Studio 2010 solution containing a number of sample plug-ins.