Hello, I'm writing in this forum, because I have doubts about how to use moodle capabilities.
I am developing a block whose content should only be visible to administrators, teachers and non editing teachers.
I show you how is my code:
Capability definition in access.php
My block is located in site-index.
I'm logged in as a teacher, but it shows the message you do not have permission!!
Could you help me know what I'm doing wrong?
thank you very much to all!!
Do you have Debugging set to developer level?
If you switch it on, I suspect you *might* get a warning message about 'unknown capability'.
If that is the case, then you need to increase the version number of your plugin, in order to tell Moodle that it needs to check all the files in your plugin's db/ folder to see if there are any changes.
I have the debugging activated in developer mode, but it does not show any error or warning message.
Increase the version of my block in the version.php file.
I do not understand where the error is.
I'm logged in as a tutor
It looks like your block is displaying on the front page of the site.
Is the test user a tutor at the site level, or just at a course level?
If they're only a tutor at the course level (the usual case), then they won't have any of the tutor-specific capabilities at the site level.