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:
- Get the manager.
Get an instance of the ForumsManager object.
- Create the forums data.
- Suppress the automatic calculation.
To suppress the automatic calculation, call the SuppresStatisticsCalculation method of the manager before calling the SaveChanges method.
- Save the changes.
Save the changes to the manager.
- 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: