There are lots of examples of seeing if the current user has a particular role. I need lightweight function to see if another user has a particular role.
For comments, I want to highlight comments from users who have a particular role, "Guest Blogger". Using
hook_preprocess_comment(&$variables) I can load up each user using:
$user_fields = user_load($variables['comment']->uid);
But this seems rather heavy. All I need to do is see if the user has a role, not load up the entire user object.
Can someone help me out with a function or a query where I pass in the uid and the function/query passes back an array of roles?