Hello, I'm trying to enter a relationship id (rid) and the users in the relationship into node fields from a views list and I can't find it on the list. Would you please add it to views?

Thank you.

Files: 
CommentFileSizeAuthor
#6 user_relationships.add_rid_to_views_1475722_06.patch739 bytesrfay
PASSED: [[SimpleTest]]: [MySQL] 1,141 pass(es).
[ View ]

Comments

I am also curious if there is an existing way to get the rid into views?

Bump

Hi ,

you can use hook_views_pre_render(&$view)..For example

function modulename_views_pre_render(&$view) {
  if ($view->name == 'ur_view_machine_name') {
    foreach ($view->result as $res) {
       //UID of requstee user (Added <strong>uid</strong> field in view and took the relationship as requestee)
        $requestee = $res->users_user_relationships_1_uid;
       //UID of requster user (Added one more <strong>uid</strong> field in view and took the relationship as requester)
        $requester = $res->users_user_relationships_uid;
        //dsm($requestee);
        //dsm($requester);
        $row_rid = db_query("Select rid from {user_relationships} WHERE requestee_id = '$requestee' AND requester_id = '$requester' AND approved = '1' AND rtid = '1'");
<strong>//Get the rid</strong>
    }
  }
}

This is a super important request!

Version:7.x-1.0-alpha4» 7.x-1.x-dev

Status:Active» Needs review
StatusFileSize
new739 bytes
PASSED: [[SimpleTest]]: [MySQL] 1,141 pass(es).
[ View ]

This should do the trick. Thanks to Tag1 Consulting for supporting this and contributing it back.

Status:Needs review» Reviewed & tested by the community

A clear yes!

Status:Reviewed & tested by the community» Fixed

Committed and pushed, thanks!

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.