moodleou / moodle-mod_forumng

ForumNG forum module for Moodle
19 stars 20 forks source link

Forum Availability check missing for My Home list of Forums #20

Closed aspark21 closed 10 years ago

aspark21 commented 10 years ago

On My Home, Course Overview block, under a course where a ForumNG is present, it will list the forums where there are unread posts.

Currently it will shows all forums where there are unread posts, including forums which are not yet available to students, if there was no post in the forum these wouldn't appear, however if a teacher posted a few posts ahead of time, the ForumNG would come up in the list. The students can see this but then get the "This activity is unavailable" message.

I think there should be an availability check made so that the forumNGs only appear in the unread list once they are available to students.

jason-platts commented 10 years ago

Can you clarify how it is not available to students?

There is no checking of availability - but if we are able to add then it would help to know what mechanism of restriction (visibility, time limited access, time limited posted) would need to be supported (we don't use My Moodle at all...).

aspark21 commented 10 years ago

Hi Jason,

In the particular case I noticed this, it was with a time-released topic in which the forum was located (using topcoll course format).

I guess, it would need to check for:

Thanks

sammarshallou commented 10 years ago

(I've worked a bit on this area.)

I think there is only one correct way to check availability for an activity which is to call get_fast_modinfo for a course (returning information for ALL activities on that course) and get_cm from it and then check $cm->uservisible. This will include all the first three bullet points above. There is no correct way to check availability for a single activity without doing get_fast_modinfo. (There's a function that tries to do this but it is incorrect.)

Calling get_fast_modinfo for several courses is probably ok as long as there are not too many on a page (I think the limit before performance collapses is about 25 or so). It probably happens for other reasons on 'multi-course' pages anyhow. So probably that is the correct fix.

jason-platts commented 10 years ago

Fixed, see: https://github.com/moodleou/moodle-mod_forumng/commit/7155b3d8b2f5a125b1e3e0fca84a2ea77ea8d96c