How do I prevent a student user from posting a comment in a Moodle Comment Field?

How do I prevent a student user from posting a comment in a Moodle Comment Field?

by Frankie Kam -
Number of replies: 1
Picture of Plugin developers

Hi All

I have added a Moodle comment field into my Dataform database. The problem I face is that I am unable to prevent a Student user from typing and saving a comment. The student user is able to type, save and delete his own comments.



Below are my permissions overrides for "Student" role at the Dataform activity level:



Below are my permissions overrides for "Student" role at the Course level:


And here is proof that the user (Wallace) is assigned "Student" role.



So I do not know where I have gone wrong. Any ideas anyone why Wallace can still post and delete comments inside the Dataform field which is of type "Moodle Comments"? Any help is appreciated.

Regards
Frankie Kam 

Average of ratings: -
In reply to Frankie Kam

Re: How do I prevent a student user from posting a comment in a Moodle Comment Field?

by Priya Shanu -

Have you added permissions for comments...?

in db/accesss.php of dataform folder?If yes then exclude 'student' => CAP_ALLOW, from each

functionality such as comment delete,comment post etc.

'mod/dataform:commentdelete' => array(

'captype' => 'write',

'contextlevel' => CONTEXT_MODULE,

'archetypes' => array(

    'guest' => CAP_ALLOW,

    'teacher' => CAP_ALLOW,

    'editingteacher' => CAP_ALLOW,

    'manager' => CAP_ALLOW

   )

),