Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm trying to set up user relationship module, so I created user relationship type "friend" this is two-way relationship.
For testing reasons I don't have "Requires Approval" checked and now when I added 8 friends they are all listed on /relationships page, but when I added 9,10,11th this list still shows only 8 friends. It will eventually show more than 8 users, but still some of them are missing.
Comments
Comment #1
alex.k CreditAttribution: alex.k commentedCommitted a fix for this in http://drupal.org/cvs?commit=230894. The problem was in the way the query in _user_relationships_generate_query() was generated. It returned both directions of two-way relationships in some cases, especially when using 'between' or 'user' parameters without sorting by rid (which naturally removed duplicates and masked the error).
So the default behavior of user_relationships_load has changed to not return these duplicates by default, which I think makes sense. This automatically fixes the problem described above, as well as in UR Blocks #481216: Wrong amount of users displaying in User Relationships: friends block. In case the old behavior is needed (not a typical usage I think), one can add 'include_twoway_reverse' => TRUE in the $options argument to user_relationships_load.
Please test this for any other side-effects - I added some simpletests to check it doesn't affect other usages, but having someone check on real data would be helpful.
Comment #2
alex.k CreditAttribution: alex.k commentedSecond part of the fix committed, http://drupal.org/cvs?commit=230908.
Comment #3
alex.k CreditAttribution: alex.k commentedAdditional test cases and corresponding fixes in http://drupal.org/cvs?commit=230982. Hope that's it.
Comment #4
alex.k CreditAttribution: alex.k commentedPer reports in http://drupal.org/node/465752#comment-1792438 reopening this issue
Comment #5
alex.k CreditAttribution: alex.k commentedCommitted a fix for the above in http://drupal.org/cvs?commit=235636 with additional test cases.
Comment #6
ayalon CreditAttribution: ayalon commentedThanks for committing that fix.
I searched several hours because all my "Received requests" didn't show up in my pending block. I found out, that the problem is in _user_relationships_generate_query() but I did not manage to find a solution.
Thanks a lot!
Comment #8
ih2502mk CreditAttribution: ih2502mk commentedCan somebody create a patch or provide a code snippet of solution to this issue. Since drupal is on git and the link http://drupal.org/cvs?commit=235636 does not work.
Thank you in advance.
Comment #9
mrf CreditAttribution: mrf commentedcommit a081ab7335c6364c0e982388f370189de36038b7, and commit db1cd4ec30955df74e91630fa40e6887b19dbc2c I am pretty sure are the two referenced commits in this issue, looking at in reference to #913510: Unable to remove friends