Forum statistics

The forums provide statistics about the following:

  • Last post in a forum/thread
  • Last user that has posted in a forum/thread
  • Count of posts in a thread/forum
  • Amount of views of a thread

The statistics can be accessed through the respective properties of the For developers: Forums and the For developers: Forum threads object.

These statistics get automatically updated upon creating, modifying or deleting threads or posts.

Manual statistics calculation

If you are importing large set of data through the Forums API, you can suppress the automatic calculation and execute it manually after the data import is done. To do this you must perform the following:

  1. Get the manager.
    Get an instance of the ForumsManager object.
  2. Create the forums data.
  3. Suppress the automatic calculation.
    To suppress the automatic calculation, call the SuppresStatisticsCalculation method of the manager before calling the SaveChanges method.
  4. Save the changes.
    Save the changes to the manager.
  5. Update the statistics.
    To update the statistics, you call the static RecalculateAllForumStatistics method of the ForumsManager class. This call will cause the statistics for all forums and threads to get updated.

    NOTE: If you want to update the statistics only for a specific forum or thread, you call the UpdateForumStatistics method or the UpdateThreadStatistics method of the ForumsManager instance and pass the respective forum or thread  ID as an argument. Note that when calling one of these methods, you must save the changes at the end.

Here is a code example for the RecalculateAllForumStatistics method:

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?

Next article

Forum subscriptions