What's the best way to determine whether a given user has the student role (and only the student role) in a course? I could use the get_user_roles_in_course() function like this:
$role = get_user_roles_in_course($id,$course->id);
if ($role == 'student') echo "Is a student";
but that seems rather clunky to me.
The goal is to display text to an admin user on a user:view page if the user is a student, and different text if they are not.