Is there a php function to to check if logged in user is a manager?

Re: Is there a php function to to check if logged in user is a manager?

by John Okely -
Number of replies: 0

In moodle, we don't give someone the ability to do something directly based on their role (except for admin which should be able to do anything) but instead based on the capabilities their role has. This is so that you can customise a role to allow or not allow individual capabilities.

Not all sites will have a manager, but they may have a similar role created from the manager archetype. So to achieve this, you will need to add a new capability to your plugin, and give it to the manager archetype by default. Then in your code you can check if the current user has that capability. Then you can say that the manager archetype has that capability by default.

For more information there is a docs article here: https://docs.moodle.org/dev/Access_API