Currently in my system we have 4 roles : course admin, trainer, student, corporate user.
Once login we need to redirect to custom Dashboard where we will display custom functionalities.
So I'm wondering how we can implement that considering we have only user id.
I got option based on course
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
if (!has_capability('moodle/course:viewhiddensections', $coursecontext)) {
echo "is Student<br/>";
}
But in my case we have only user id. How we can implement this? I hope Moodle is not so complicated to do such small check.