Forums events

Overview

The Forums module exposes a number of events for its data items. They are organized in a hierarchy of interfaces. We recommend that you use the interfaces to subscribe for the events and not the specific classes. By using parent interfaces, you can subscribe to all child events. However, you lose the specific typed data which gets passed to your event handler as an argument. This is why we recommend using the most specific interfaces (those that don't have child interfaces, but are directly implemented by classes). This is the full event interface hierarchy for the Forums module.

IForumsModuleEvent

This interface is implemented by all events in the Forums module. If you subscribe to it, your handler will be invoked for each of its child events. You can subscribe using the following code.

When you subscribe to events using this interface, you can access the UserId of the currently logged in user (whose action caused the event to fire).

IForumEvent

This interface is implemented by all events related to an action performed on a Forum object. Use it if you want your code to execute whenever something is done with a Forum. You can subscribe using the following code.

IForumDataEvent

This interface is implemented by all Forum object events that manipulate data, namely IForumCreatedEvent, IForumCreatingEvent, IForumUpdatedEvent, IForumUpdatingEvent, IForumDeletingEvent, and IForumDeletedEvent. Use it if you want to subscribe to both. To subscribe, you can use the following code.

In your event handler, you can access the Forum object which the event was fired for.

IForumCreatedEvent

This interface is implemented by the events that fire when a Forum object is created. There is only one built-in event that implements it, but you should subscribe to the interface, not the class, as mentioned in the beginning. You can subscribe using the following code.

In the event handler, you can access the actual Forum object which the event was fired for.

IForumCreatingEvent

This interface is implemented by the events that fire when a Forum object is creating. There is only one built-in class that implements it - ForumCreatingEvent, but you should subscribe to the interface, not the class, as mentioned in the beginning. You can subscribe using the following code.

In the event handler, you can access the actual Forum object which the event was fired for.

IForumUpdatedEvent

This interface is implemented by the events that fire when a Forum object is updated. There is only one built-in event that implements it, but you should subscribe to the interface, not the class, as mentioned in the beginning. You can subscribe using the following code.

In the event handler you can access the Forum object which the event was fired for.

IForumUpdatingEvent

This interface is implemented by the events that fire when a Forum object is updating.You can subscribe using the following code.

In the event handler you can access the Forum object for which the event was fired.

IForumDeletedEvent

This interface is implemented by the events that fire when a Forum object is deleted. There is only one built-in event that implements it, but you should subscribe to the interface, not the class, as mentioned in the beginning. You can subscribe using the following code.

In your event handler you can access the following data:

  • The date when the forum was deleted
  • The Forum ID
  • The UserId of the current user

IForumDeletingEvent

This interface is implemented by the events that fire when a Forum object is deleting. You can subscribe using the following code:

In your event handler you can access the UserId of the current user

IForumGroupEvent

This interface is implemented by all events related to an action performed on a ForumGroup object. You can subscribe to all of them using the following code:

In the event handler, you can access the following data:

  • The UserId of the currently logged in user.
  • The ID of the ForumGroup for which the event was fired.

IForumGroupDataEvent

This interface is implemented by all ForumGroup object events that manipulate data, namely IForumGroupCreatedEvent and IForumGroupUpdatedEvent. Use it if you want to subscribe to both. To subscribe to them, you can use the following code.

In the event handler, you can access the following information:

  • The UserId of the currently logged in user.
  • The ID of the ForumGroup object for which the event was fired
  • The Title of the ForumGroup object
  • The Visible property of the ForumGroup object.

IForumGroupCreatedEvent

This interface is implemented by the events that fire, when a ForumGroup object is created. There is only one built-in event that implements it, but you should subscribe to the interface, not the class, as mentioned in the beginning. You can subscribe using the following code.

In the event handler you can access the following information:

  • The UserId of the currently logged in user.
  • The ID of the ForumGroup object for which the event was fired
  • The Title of the ForumGroup object
  • The Visible property of the ForumGroup object.
  • The date when the ForumGroup object was created

IForumGroupUpdatedEvent

This interface is implemented by the events that fire when a ForumGroup object is updated. There is only one built-in event that implements it, but you should subscibe to the interface, not the class, as mentioned in the beginning. You can subscribe using the following code.

In the event handler, you can access the following information:

  • The UserId of the currently logged in user
  • The ID of the ForumGroup object for which the event was fired
  • The Title of the ForumGroup object
  • The Visible property of the ForumGroup object
  • The date when the ForumGroup object was modified

IForumGroupDeletedEvent

This interface is implemented by the events that fire when a ForumGroup object is deleted. There is only one built-in event that implements it, but you should subscribe using the interface, not the class, as mentioned in the beginning. You can subscribe using the following code.

In the event handler, you can access the following information:

  • The UserId of the currently logged in user
  • The ID of the ForumGroup object for which the event was fired
  • The date when the ForumGroup object was deleted

IForumThreadEvent

This interface is implemented by the events that fire when an action is performed on a ForumThread object. Use the following code to subscribe.

In the event handler, you can access the UserId of the currently logged in user.

IForumThreadDataEvent

This interface is implemented by all events for the ForumThread object that manipulate data, namely IForumThreadCreatedEvent, IForumThreadCreatingEvent, IForumThreadUpdatingEvent, and IForumThreadUpdatedEvent. Use it if you want to subscribe to both. You can subscribe using the following code.

In the event handler, you can access the actual ForumThread object which was manipulated.

IForumThreadCreatedEvent

This interface is implemented by all events that fire when a ForumThread object is created. There is only one built-in event, but you should subscribe to the interface, rather than the class, as mentioned in the beginning. Use the following code to subscribe.

In the event handler, you can access the ForumThread object which was created.

IForumThreadCreatingEvent

This interface is implemented by all events that fire when a ForumThread object is creating.Use the following code to subscribe:

In the event handler, you can access the ForumThread object which is creating.

IForumThreadUpdatedEvent

This interface is implemented by all events that fire when a ForumThread object is updated. There is only one built-in event, but you should subscribe to the interface rather than the event class, as mentioned in the beginning. Use the following code to subscribe.

In the event handler, you can access the ForumThread object which was updated.

IForumThreadUpdatingEvent

This interface is implemented by all events that fire when a ForumThread object is updating. Use the following code to subscribe:

In the event handler, you can access the ForumThread object which is updating.

IForumThreadDeletedEvent

This interface is implemented by all events that fire when a ForumThread object is deleted. There is only one built-in event, but you should subscribe to the interface rather than the class, as mentioned in the beginning. Use the following code to subscribe:

In the event handler, you can access the following information:

  • The ID of the ForumThread object, which was deleted
  • The date when the object was deleted

IForumThreadDeletingEvent

This interface is implemented by all events that fire when a ForumThread object is deleting. Use the following code to subscribe:

In the event handler, you can access the UserId of the currently logged in user.

IForumPostEvent

This interface is implemented by all events fired when an action on a ForumPost object is performed. You can subscribe for all such actions using the following code:

In the event handler, you can access the user ID of the currently logged in user.

IForumPostDataEvent

This interface is implemented by all events for the ForumPost object, which manipulate data, namely IForumPostCreatedEvent and IForumPostUpdated event. Use it to subscribe for both. You can use the following code to subscribe:

In the event handler, you can access the following information:

  • The UserID of the currently logged in user.
  • The actual ForumPost object which was manipulated

IForumPostCreatingEvent

This interface is implemented by all events that fire before a ForumPost object is created. There's only one built-in event, but you should subscribe to the interface, rather than the class, as mentioned in the beginning. Use the following code to subscribe.

In the event handler, you can access the following information:

  • The UserID of the currently logged in user
  • The actual ForumPost object which is about to be created

IForumPostCreatedEvent

This interface is implemented by all events that fire after a ForumPost object is created. There's only one built-in event, but you should subscribe using the interface rather than the class, as mentioned earlier. You can use the following code to subscribe.

In the event handler, you have access to the following information:

  • The UserID of the currently logged in user.
  • The actual ForumPost object which was created.

IForumPostUpdatingEvent

This interface is implemented by all events that fire before a ForumPost object is updated. There's only one built-in event, but you should subscribe using the interface rather than the class, as mentioned in the beginning. Use the following code to subscribe.

In the event handler you have access to the following information:

  • The UserID of the currently logged in user
  • The actual ForumPost object which is about to be updated

IForumPostUpdatedEvent

This interface is implemented by all events which fire after a ForumPost object has been updated. There's only one built-in event, but you should subscribe using the interface rather than the class, as mentioned in the begining. Use the following code to subscribe:

In the event handler you can access the following information:

  • The UserID of the currently logged in user
  • The actual ForumPost object which was updated

IForumPostDeletingEvent

This interface is implemented by all events which fire before a ForumPost is deleted. Use the following code to subscribe.

In the event handler, you can access the UserID of the currently logged in user.

IForumPostDeletedEvent

This interface is implemented by all events which fire after a ForumPost is deleted. There's only one built-in event, but you should subscribe using the interface rather than the class, as mentioned in the beginning. Use the following code to subscribe.

In the event handler, you can access the following information:

  • The UserId of the currently logged in user
  • The ID of the ForumPost object which was deleted
  • The date when the object was deleted

IForumAttachmentEvent

This interface is implemented by all events which fire when operations on forum attachments are performed. You can subscribe using the following code.

Forum attachments are just documents stored in special libraries for the Forum. Those documents are linked to forum posts by a ContentLink object. In the event handler, you can access this content link object, and through its properties find the corresponding attachment.

IForumAttachmentCreatedEvent

This interface is implemented by all events which fire after a Forum attachment is created. There's only one built-in event, but you should subscribe using the interface rather than the class, as mentioned in the beginning. Use the following code to subscribe.

In the event handler you can access the ContentLink object which contains information about the linked document.

NOTE: This event is raised starting with Sitefinity CMS version 13.1.7425 and later.

IForumAttachmentDeletedEvent

his interface is implemented by all events which fire after a forum attachment is deleted. There's only one built-in event, but you should subscribe using the interface rather than the class, as mentioned in the beginning. Use the following code to subscribe.

In the event handler you can access the following information:

  • The UserId of the currently logged in user
  • The date when the attachment was deleted
  • A ContentLink object that contains information about the document representing the actual attachment

NOTE: This event is raised starting with Sitefinity CMS version 13.1.7425 and later.

 

ISubscriptionCreatedEvent

This interface is implemented by all events which fire when a subscription is created in the Forums module. Depending on the object for which the subscription was created, you can use specific interfaces (Forum, Thread). If you use this interface, all events will fire, no matter what is the object. You can subscribe using the following code.

In the event handler, you can access the following information:

  • The UserId of the currently logged in user
  • The date when the subscription was created
  • The name of the user provider, in which the subscribed user is stored.

IForumSubscriptionCreatedEvent

This interface is implemented by all events which fire when a subscription is created for a Forum object. There's only one built-in event, but you should subscribe using the interface rather than the class, as mentioned in the beginning. Subscribe using the following code:

In the event handler you can access the following information:

  • The UserId of the currently logged in user (subscriber)
  • The date when the subscription was created
  • The name of the user provider, in which the user is stored
  • The ID of the forum for which the user subscribed
  • The name of the forum provider in which the forum is stored

IForumThreadSubscriptionCreatedEvent

This interface is implemented by all events which fire when a subscription is created for a ForumThread object. There's only one built-in event, but you should subscribe using the interface rather than the class, as mentioned in the beginning. Subscribe using the following code:

In the event handler, you can access the following information:

  • The UserId of the currently logged in user (subscriber)
  • The date when the subscription was created
  • The name of the user provider, in which the user is stored
  • The ID of the ForumThread object for which the user subscribed
  • The name of the forum provider in which the forum thread is stored

ISubscriptionDeletedEvent

This interface is implemented by all events which fire after a subscription is deleted. Depending on the object for which the subscription was created, you can use specific interfaces (Forum, Thread). If you use this interface, all events will fire, no matter the object. Subscribe using the following code.

In the event handler, you can access the following information:

  • The UserId of the currently logged in user (subscriber)
  • The date when the subscription was deleted
  • The name of the user provider where the user is stored

IForumSubscriptionDeletedEvent

This interface is implemented by all events which fire after a Forum subscription has been deleted. There's only one built-in event, but you should subscribe using the interface rather than the class, as mentioned in the beginning. Subscribe using the following code.

In the event handler, you can access the following information:

  • The UserId of the currently logged in user (subscriber)
  • The name of the user provider where the user is stored
  • The date when the subscription was deleted
  • The ID of the Forum object for which the subscription was created
  • The name of the forum provider where the Forum object is stored

IForumThreadSubscriptionDeletedEvent

This interface is implemented by all events which fire after a ForumThread subscription has been deleted. There's only one built-in event, but you should subscribe using the interface rather than the class, as mentioned in the beginning. Use the following code to subscribe.

In the event handler, you can access the following information:

  • The UserId of the currently logged in user (subscriber)
  • The name of the user provider where the user is stored
  • The date when the subscription was deleted
  • The ID of the ForumThread object for which the subscription was created
  • The name of the forum provider where the ForumThread object is stored

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?