Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-37743

Users not enrolled in a course cannot reply to forum posts, even if explicitly permissioned to do so.



    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 2.4.1
    • None
    • Forum


      Despite the permissions that are explicitly afforded to a role in a course forum, Moodle will not permit the user to reply to a forum discussion if the user is not explicitly enrolled in the course. While it stands to reason that 99% of the time this behavior is desirable, it's arguable that the truly elegant permissions system in Moodle should accommodate the unique needs of some organizations to have non-enrolees reply to posts in a course forum. The code in /mod/forum/lib.php explicitly probibits non-enrollees from replying. What is most noteworthy is that this hard-coded restriction does not apply to all actions within the forum; namely, once properly permissioned, the non-enrolled user can successfully view discussions, start new discussions, edit any post, or delete any post. It is just replying that seems to be explicitly prohibited via the code.

      I believe that this code is probably "left over" from the days when Moodle did not have such an elegant, granular permissions system - at which point there probably were hard and fast rules dictating that only course enrolees could participate in forum discussions.

      I think that this code ought be considered for removal from /mod/forum/lib.php within forum_user_can_post():
      if (!is_viewing($context, $user->id) and !is_enrolled($context, $user->id, '', true))

      { return false; }

      A detailed discussion is contained here:




            Unassigned Unassigned
            jamatrucola Joe Amatrucola
            Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Stevani Andolo
            10 Vote for this issue
            11 Start watching this issue