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!
Comment | File | Size | Author |
---|---|---|---|
Relationships Venn diagram.png | 11.94 KB | owenblacker |
Comments
Comment #1
owenblacker CreditAttribution: owenblacker commentedLast 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 Ireturn TRUE;
if that query results in more than zero rows.Unfortunately, this doesn't seem to have any effect. Am I missing something obvious?
Comment #2
owenblacker CreditAttribution: owenblacker commentedFixed 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
Comment #3
mrf CreditAttribution: mrf commentedComment #5
Flow_TnT CreditAttribution: Flow_TnT commentedI 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.