Closed nadavkav closed 10 years ago
But get_num_unread_discussions() does work, for example see index.php.
The reason it doesn't work on the activity info is because of the way the forums are gathered in lib.php.
See mod_forumng_cm_info_view()
mod_forumng::get_course_forums needs to be called with the UNREAD_DISCUSSIONS constant instead of UNREAD_BINARY.
It uses a read/unread flag rather than actual number of unread as this is much quicker to calculate (which is necessary for the course home page as this info is real-time and not cached).
Thanks! ( I knew there must be a good reason for it )
I will pass this information forward to our teachers and see how important that information is to them.
Hi Guys! I installed ForumNG (module v.2013102500) on my Moodle 2.5.2+ test server (Linux using postgres). It's working pretty nice for us except that is still not showing the 'unread posts' counts on both the course front page and the ForumNG posting page. I updated mod_forumng.php with the suggested additions (Calculate number of unread discussions) but it's still not showing any counts. (see images below)
Any other ideas?
I'm assuming you have enabled forumng_trackreadposts in the module admin settings?
You should not be using the code attached to this pull as that was incorrect.
If you wanted to show number of unread rather than just the unread flag on the course front page then you will need to update mod_forumng_cm_info_view() in lib.php (though as suggested this is not recommended due to the performance hit).
Hi Jason. Yes, I had enabled it.
I continued playing a little bit more and started to compare both the Forum and ForumNG admin settings. One of the things I changed was the # of days in forumng_readafterdays. It had the default setting but once I changed to a different #, it worked as expected. Thanks for getting back so fast and hope this feedback can help others.
Translated token "hasunreadposts" used to show the unread discussion count, but not anymore.
While adding the "unread discussion count" as a parameter to the token, I noticed forumfields->numunreaddiscussions does not properly hold the actual number of discussions that has new posts in them.
So here is a suggested fix for get_num_unread_discussions() which does not seem to work properly when using it to view unread (post) discussions on the course front page.
I use it together with: get_string('hasunreadposts', 'forumng', $forums[$cm->instance]->get_num_unread_discussions());
$string['hasunreadposts'] = '({$a} Unread posts)';
What do you think?