Problem Description
I am new to `Moodle` and I have the following code:
$userDetails = $DB->get_record('user', array('id' => $singleuser->userid));
var_dump($userDetails);
echo $userDetails->firstname." ".$userDetails->lastname
It is having the details of user table in `Moodle`. How can I find the role like Teacher, Admin, student?
Here I am having the userids `$singleuser->userid` . I am printing Users full name . I need the role along with it like the following:
echo $userDetails->firstname." ".$userDetails->lastname.$role.
How can I find role? Please guide me.
**Moodle Version: 2.9.1**
AI-Generated Solution
Powered by LMSouq AI · GPT-4.1-mini
Analyzing problem and generating solution…
Was this solution helpful?