--- user_relationship_views.views.inc	(revision 2051)
+++ user_relationship_views.views.inc	(working copy)
@@ -266,7 +266,28 @@
   );
   return $tables;
 }
+
 /**
+ * Implementation of hook_views_data_alter().
+ *
+ * Use views_data_alter to add items to the node table that are
+ * relevant to comments.
+ */
+function user_relationship_views_views_data_alter(&$data) {
+  $data['node']['user_relationship_uid_touch'] = array(
+    'title' => t('User relationship posted or commented'),
+    'help' => t('Display nodes only if a user relationship posted the node or commented on the node.'),
+    'argument' => array(
+      'field' => 'uid',
+      'name table' => 'users',
+      'name field' => 'name',
+      'handler' => 'views_handler_argument_user_relationships_node_uid_touch',
+    ),
+  );
+  return $data;
+}
+
+/**
  *  Implementation of hook_views_handlers().
  */
 function user_relationship_views_views_handlers() {
@@ -283,6 +304,7 @@
       'views_handler_filter_user_relationships_type' => array('parent' => 'views_handler_filter_in_operator'),
       'views_handler_field_user_relationships_oneway' => array('parent' => 'views_handler_field'),
       'views_handler_field_user_relationships_status_link' => array('parent' => 'views_handler_field'),
+      'views_handler_argument_user_relationships_node_uid_touch' => array('parent' => 'views_handler_argument_comment_user_uid'),
     ),
   );
 }
--- views_handler_argument_user_relationships_node_uid_touch.inc	(revision 0)
+++ views_handler_argument_user_relationships_node_uid_touch.inc	(revision 0)
@@ -0,0 +1,83 @@
+<?php
+// $Id$
+
+/**
+ * Argument handler to accept a user id to check for nodes that
+ * user's related associates posted or commented on.
+ */
+class views_handler_argument_user_relationships_node_uid_touch extends views_handler_argument_comment_user_uid {
+  function has_extra_options() { return TRUE; }
+
+  function extra_options_form(&$form, &$form_state) {
+    $form['user_relationships'] = array(
+      '#type' => 'fieldset',
+      '#title' => t('User Relationship'),
+    );
+
+    $options = array();
+    $result = db_query("SELECT rtid, name FROM {user_relationship_types}");
+    while ($row = db_fetch_object($result)) {
+      $options[$row->rtid] = check_plain($row->name);
+    }
+    $form['user_relationships']['rtid'] = array(
+      '#type' => 'checkboxes',
+      '#title' => t('Relationship type'),
+      '#options' => $options,
+      '#default_value' => is_array($this->options['user_relationships']['rtid']) ? $this->options['user_relationships']['rtid'] : array(),
+      '#description' => t('If no options are selected, any relationship type will match.'),
+    );
+
+    $form['user_relationships']['approved'] = array(
+      '#type' => 'select',
+      '#title' => t('Approved'),
+      '#options' => array(2 => t('Any'), 1 => t('Yes'), 0 => t('No')),
+      '#default_value' => $this->options['user_relationships']['approved'],
+    );
+  }
+
+  function query() {
+    $this->ensure_my_table();
+
+    // Lookup user ids of associates.
+    $associates = array();
+    if ($this->argument_validated && $this->argument > 0) {
+      $args = array('user' => $this->argument);
+
+      // Add relationship type filter, if defined.
+      if (!empty($this->options['user_relationships']['rtid'])
+          && is_array($this->options['user_relationships']['rtid'])) {
+        $args['rtid'] = $this->options['user_relationships']['rtid'];
+      }
+
+      // Add approved filter, if specified.
+      if ($this->options['user_relationships']['approved'] == 0
+          || $this->options['user_relationships']['approved'] == 1) {
+        $args['approved'] = $this->options['user_relationships']['approved'];
+      }
+
+      foreach (user_relationships_load($args) as $row) {
+        $associates[] = ($row->requester_id == $this->argument) ? $row->requestee_id : $row->requester_id;
+      }
+    }
+
+    if (empty($associates)) {
+      // This argument has no associates.  Query result would be empty.
+      // TODO Is this the proper way to bail?
+      $this->query->add_where(0, "FALSE");
+      return;
+    }
+
+    // Use list of associates in final query.
+    $placeholder = db_type_placeholder('int');
+    $placeholders = $placeholder . str_repeat(',' . $placeholder, count($associates) - 1);
+
+    // We include the WHERE condition twice in the query, so we need two
+    // copies of these argument values.
+    $args = array_values($associates);
+    $args = array_merge($args, $args);
+
+    $this->query->add_where(0, "$this->table_alias.uid IN (" . $placeholders . ") OR
+      ((SELECT COUNT(*) FROM {comments} c WHERE c.uid IN (" . $placeholders . ") AND c.nid = $this->table_alias.nid) > 0)",
+      $args);
+  }
+}
