Dynamically adding a CSS class to a view row with template.php
function pgc_preprocess_views_view_unformatted__home_listing(&amp;$vars) {
  // Borrowed this bit from http://drupal.org/node/312220
  $view = $vars['view'];
  $rows = $vars['rows'];

  foreach ($rows as $id =&gt; $row) {
    $data = $view-&gt;result[$id];
    $event_class = get_the_classes($data-&gt;nid);
    $vars['classes'][$id] .= ' ' . $event_class;
  }
}

function get_the_classes($nid) {
  $node = node_load($nid);
  global $user;
  if ($user-&gt;uid != 0) { // Not for anon users.
    $event_class = '';
    if ($node-&gt;field_trainer[0]['uid'] == NULL) {
        $event_class= 'red';
    } else {
        $num_trainers = $node-&gt;field_number_of_trainers[0]['value'];
        $count = count($node-&gt;field_trainer);
        if($count &lt; $num_trainers) {
            $event_class = 'red';
        } else {
            $event_class = 'green';
        }
    }
    return $event_class;
  }
}


Don't know if it's pretty.  Don't know how it performs.  But it works.

EDIT (02-01-2012): after working with Drupal for another year now, I'd have tried to find some other way to do this besides running node_load() on every row of the view.