Display content based on role

Display content based on role

by Mark Findlay -
Number of replies: 0


Hi,

we have a situation where some moodle students are also staff members who support the system via a helpdesk role.

Very occasionally a member of staff finds themselves looking at a course via the helpdesk role, which they are studying as a student. There is of course potential to see content they shouldn't in these circumstances.

To mitigate this we want to add some text in a yellow box under the banner, which says:
You are logged in as a Helpdesk/Admin User.

Admin is easy to deal with as a function exists to deal with that, but the documentation states access should be controlled by capability, is it possible to create a custom capability in the gui? I can't see any way to.

Essentially in the theme we want to add (in English):

if site admin (
You are logged in as a Site administrator (easy)
)

else if helpdesk  (
You are logged in as a Helpdesk user
)
else (
do nothing
)

So how do I pick up the helpdesk role as a variable, or add a new capability - you wouldn't/shouldnt add capabilities in theme?

Thanks in advance,
Mark.

Average of ratings: -