I'm using UR to create unidirectional friendships between users on my site. The friending paradigm is like Twitter, where Alice may follow Bob and that does not imply that Bob also follows Alice. That said, Bob is able subsequently to choose to follow Alice.

Looking in the database table user_relationships, I can see that this situation results in two rows for a reciprocated relationship (the mySQL except is on the StackExchange ticket I mention below). Now I have a View that shows me all the users following $current_user, except that I want only those users that $current_user does not also follow back in return. Referring to the Venn diagram I've attached to this ticket, I currently have B ∪ C, whereas I only want C.

If I go to add a new Contextual Filter to my view, I don't have any option to check the lack of a reciprocating row in the database (as it is not a property of the individual row I'm showing).

So how do I achieve this? I guess I'm going to have to write some PHP to prevent displaying users where this is the case and there are custom modules in my site already, but I don't understand Drupal well enough to know what hook I'm looking for or where to intercept the processing of the rows being displayed.

Help, please? :o)

I've opened a question on Drupal Stack Exchange that explains this issue with a little more detail; it would be slightly useful if people could reply there, in case I miss comments and suggestions here, but I will try to check both places. Thanks everyone!

CommentFileSizeAuthor
Relationships Venn diagram.png11.94 KBowenblacker
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

owenblacker’s picture

Last night I noticed that I have the ability to add PHP Filter Criteria (which I'd somehow not noticed before!), so I added one that checks the SQL query Select * From user_relationships Where requester_id = :current_uid And requestee_id = :follower_uid and I return TRUE; if that query results in more than zero rows.

Unfortunately, this doesn't seem to have any effect. Am I missing something obvious?

owenblacker’s picture

Fixed it: http://drupal.stackexchange.com/a/25709/3966

I also added some other information I found at least slightly useful to the same Drupal.SE ticket: http://drupal.stackexchange.com/a/25712/3966

mrf’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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

Flow_TnT’s picture

I was doing a little digging around for help to tie Context and User Relationships together, and found this post. While your post wouldn't really help me, I'd like to say it's nice to see you post your own findings, even if no one else chimed in.