Hello to the community,
I try to set up a block that shows up on the courses for a certain type of user. In addition, the contents of this block is variable depending on the course category. I tried in a first time only change the contents of the block depending on the user's role and, even for this task which sounds simple, I have difficulty.
I created a acces.php file containing the following code:
$ capabilities = array ( 'block / xxx: view' => array ( 'captype' => 'read', 'contextlevel' => CONTEXT_COURSE, 'archetypes' => array ( 'student' => CAP_PROHIBIT, 'admin' => CAP_ALLOW ))); |
And the function get_content my block:
if (has_capability ('block / XXX: view', $ this-> context)) { $ this-> content-> text = "<br> flag 01";} else { $ this-> content-> text = "<br> flag 02";} |
Could you tell me where I'm wrong, and how can I progress