aliases['author'] = $this->field_alias; // Get all uids taking care of repeated one. $uids = array(); foreach ($values as $result) { $uids[$result->{$this->aliases['author_uid']}] = TRUE; $uids[$result->{$this->aliases['committer_uid']}] = TRUE; } $uids = array_keys($uids); if (count($uids) > 0) { $placeholders = implode(',', array_fill(0, count($uids), '%d')); $result = db_query("SELECT u.uid, u.name FROM {users} u WHERE u.uid IN ( $placeholders )", $uids); while ($row = db_fetch_object($result)) { $this->usernames[$row->uid] = $row->name; } } } function render($values) { $author_uid = $values->{$this->aliases['author_uid']}; $committer_uid = $values->{$this->aliases['committer_uid']}; // Render the author. $this->aliases['person_uid'] = $this->aliases['author_uid']; $this->field_alias = $this->aliases['author']; $this->aliases['person_username'] = 'author_username'; $values->{$this->aliases['person_username']} = $this->usernames[$author_uid]; $author = parent::render($values); // Show only author if they are equal. if ($author_uid == $committer_uid) { return t('by !author', array('!author' => $author)); } // Show both if they are different. $this->aliases['person_uid'] = $this->aliases['committer_uid']; $this->field_alias = $this->aliases['committer']; $this->aliases['person_username'] = 'committer_username'; $values->{$this->aliases['person_username']} = $this->usernames[$committer_uid]; $committer = parent::render($values); return t('authored by !author, committed by !committer', array( '!author' => $author, '!committer' => $committer)); } }