I need to know if a user has a certain Role. How can I get what Role a user is?
by doing a simple:
pint_r($USER->access)
=> I do get a lot of different information, but basically it seems like there is no definitive attribute that can be compared between users to check what kind of Role this User actually is.
For a user it looks like:
[access] => Array
(
[ra] => Array
(
[/1/8/9] => Array
(
[0] => 5
[1] => 5
)
[/1] => Array
(
[0] => 7
)
)
[rdef] => Array
(
[/1:5] => Array
(
[moodle/block:view] => 1
.....
For a Admin it looks like:
[access] => Array ( [ra] => Array ( [/1] => Array ( [0] => 1 [1] => 7 ) ) [rdef] => Array ( [/1:1] => Array ( [block/online_users:viewlist] => 1
So how do you see now what kind of Role this User is?
thanks,
sebastian