How to build a block view that shows comon friends (related users) between the profile page that is seen and the logged user?
thanks for your work

Comments

dawehner’s picture

Whats your definition of related users?

This could be everything.

mortenson’s picture

On User Relationships module, I have build a relationship calles "friend".
For example:

User A is friend of F, G, H
User B is friend of F, G, K

So, if user A visits the profile of user B, the "common friends" bock should display users F and G. The same as facebook common friends.

Hope is clear now,

dawehner’s picture

Project: Views (for Drupal 7) » User Relationships
Version: 6.x-3.0-alpha2 » 6.x-1.x-dev
Component: Miscellaneous » Documentation

I think this is not a question for VIews. Its a specific question for User Relationships.

See http://drupal.org/node/239162 . I think this is a similar issue

mortenson’s picture

That post is for building a "people you might know" block, it is different.
A common friends user is much simple.
Views has the potential of building this block.

likewhoa’s picture

subscribing

dc1258’s picture

I am going to pay for the development of a block/module which will allow mutual friends to be shown. Would anyone be interested in sharing the cost with me?

I also am going to pay for a friend of a friend (people you might know) feature to be developed.

Please let me know if you're interested!

okday’s picture

subscribing

nonom’s picture

subscribing

Chachrist Srisuwanrat’s picture

Component: Documentation » Code

//This is what i used. I hope it helps.
//arg(2) is the name of viewed profile

function ur_common_friends_block($op='list', $delta=0, $edit=array()){
switch ($op) {
case 'list':
$blocks[0]['info'] = t('Common friends');
return $blocks;
case 'view':
$blocks['subject'] = t('Common Friends');
$blocks['content'] = _get_common_friends();
return $blocks;
}
}

function _get_common_friends(){
$output = '';
global $user;
$account = user_load(arg(2));
$result = db_query("SELECT requestee_id FROM user_relationships AS ur1
WHERE ur1.requester_id = %d AND (ur1.requestee_id IN
(SELECT ur2.requestee_id FROM user_relationships AS ur2
WHERE ur2.requester_id = %d)) ORDER BY RAND()", $user->uid, $account->uid);

while($common_friend = db_fetch_object($result)){
$friend = user_load($common_friend->requestee_id);
$output .= 'Only local images are allowed.picture.'">';
}
return $output;
}

GolDRoger’s picture

where do you have putted this function?

thx

broncomania’s picture

can u make a view of it?

mrf’s picture

Category: support » feature

Closed #692124: Adding a mutual friends block as a duplicate of this issue.

baff’s picture

now both issues are closed because of duplicate issue - One should be reopened :-)

mrf’s picture

This one should still be open, looks active to me.

mrf’s picture

Status: Active » Closed (duplicate)

Realized this is indeed a duplicate as well, leaving #239162: feature: block for "people you might know" as the authoritative mutual friends / common friends / people you might know issue.