LMSouq
moodle-core Open

Moodle how to find out the role of the logged in user

EH
Ehsan
1 month ago
3 views
Problem Description
How to get context/role of logged in user in moodle? I am trying to implement a context-aware block. The block would suggest the right quizzes to its users based on their moods. Role can be a teacher, student, teacher assistant or admin. I have already found the `get_context_instance()` & `has_compatibility()` functions, but I don't know how to use them for this purpose.

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base