link to create a user relationship type in views I have user relationship, statuses and views installed. I created a view which shows "users online". I need to add a link to the view, that would allow other users to "create a relationship" with other online users via the view.

The user relationship I created is a one way relationship and there is no need for approval. 

Thank you.
Hope this will help  you,

In Drupal 7, after configuration User relationship


Create a php field using views php module and after enabling, add below code in OUTPUT CODE within PHP tags.

  global $user;
  $opt = '';
  $requestee_id = $row-&gt;uid;
  $requester_id = $user-&gt;uid;
  if (user_is_logged_in()) {
    if ($requestee_id != $requester_id) {
      //for friend request button
      $relationships = user_relationships_load(array('between' =&gt; array($requester_id, $requestee_id)));
      if (empty($relationships)) {
        $opt = l(t('Add Friend') , "relationship/$requestee_id/request/2", array('html' =&gt; TRUE, 'absolute' =&gt; TRUE, 'query' =&gt; array('destination' =&gt; 'user/' . $requestee_id), 'attributes' =&gt; array('class' =&gt; array('ur-link add-friend-btn user_relationships_popup_link'))));
      }
      else {
        foreach ($relationships as $relationship) {
          if ($relationship-&gt;approved == 1 &amp;&amp; user_relationships_ui_check_access('view', NULL, $relationship)) {
            $opt = t('&lt;span class="already-frnd"&gt;Friends&lt;/span&gt;');
          }
        }
      }
    }
  }
  print $opt;



Note


2 is the default USER relationship.
Requester ID - Who requested and Requestee ID - to whome the user is requested. 


Make changes as per your requirement.