We at ULPGC have been suffering from this.
Students in our community courses (populated by up to 40.000 users) very often get engaged in very loooong threads. We have regularly discussions with 100-200-300 posts. Some disscussions scale up to 2500 posts!!! Those threads are on "social" forums, not "academic" ones.
We enforced a limit to the number of posts per discussion, but that has drawbacks and were about to start a project on this pagination. So this solution is much welcome. Thanks Laia!!
However, I am not sure that as it is it will address the problem completely. In addition to usability, those large discussions are a problem for performance. I see that even with pagination ALL posts are been loaded into memory like
$posts = forum_get_all_discussion_posts($discussion->id, $sort, $forumtracked);
and then the whole $post array is passed to the forum_print_discussion() helper functions.
I think that this should be avoided by using recodset and fetch_next_record.
$posts array is NOT modified within forum_print_discussion() prior to passage to helper functions, so the fetching of those posts could be delegated to the forum_print_posts_flat/nested functions.