Drupal 6: Accessing and checking if a comment author is in a given role

    I admit that I have spent more time than I should have looking for a solution to this issue - I should have looked in the Drupal documentation api.drupal.org first.
    It is relatively easy to check the roles of the current user (global values). There are also a number of approaches that have been discussed on Drupal.org and elsewhere on how to find out (get a logical TRUE/FALSE) is a given user (such as the author of a given document) is in a certain role.

    For instance,

    <?php
    $account = user_load(array('uid'=>$uid));
      // Check to see if $node->uid has the Employee role.
      if (in_array('Employee', array_values($account->roles)))
      {
        // add stuff to happen if this is true
      }
    ?>

    However, if you want to do soemthing similar for comments, it becomes a little harder. At least the solutions are not found as easily as those fro regular nodes - hence my motivation to document the simple solution I have come up with; I am sure that I am not the first one to use it.

    There is a function available called user_load() - http://api.drupal.org/api/function/user_load/6 that makes it very easy by allowing you to feed it a UID (user ID), and it returns an array of all the variables attached to that user, including the roles that this user belongs to. For comments, we can easily get the uid of the commenter using $comment->uid as such, we can get that value and feed it into user_load to access the array of values assocuated with the commenter at hand. So:

    <?php
    $u_c_uid = $comment->uid;
    $account = user_load($u_c_uid);
      // Check to see if this commenter account has the Employee role.
      if (in_array('Employee', array_values($account->roles)))
      {
        // add stuff to happen if this is true
    ?>

    As you can see, the code is very similar to the one for regular nodes, but this solution can save you a great deal of stress - I tried making a query directly fromt he DB, converting it to an array, and then checking if the role exists withinit. Also, I tried clalling the entire role into memory.