Hi,
I would like to add a condition role in my block and show different content if the user is a Teacher or Student.
This is my code of my block:
block_myblock.php
//TEACHER
if (has_capability('block/myblock:teacher', $this->context)) {
//CODE FOR TEACHER
}
//STUDENT
if (has_capability('block/myblock:student', $this->context)) {
//CODE FOR STUDENT
}
And I have a folder 'db' with 'access.php' inside:
access.php
$capabilities = array(
'block/myblock:teacher' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => array(
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
),
),
'block/myblock:student' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => array(
'student' => CAP_ALLOW,
),
),
);
But doesn't work. When I enter to my system with teacher user I don't see anything of my code (student or teacher). What I'm doing wrong?.
Thanks!
Dani