Active
Project:
User Relationship Limits
Version:
7.x-1.0-beta1
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
6 Aug 2011 at 15:52 UTC
Updated:
25 Jan 2015 at 15:57 UTC
Jump to comment: Most recent
Comments
Comment #1
mrf commentedThe creation of the relationship is supposed to fail on either side if that user id has reached its limit.
If I disable the 'include pending' option, I can have an unlimited number of pending relationships, but as soon as I try to approve too many I'll get denied.
Is it possible that pending relationships are throwing this off? I don't remember testing this specific aspect recently, so its possible this is a regression in the 7.x branch.
Comment #2
mrf commentedmelandren feel free to re-open this as a bug report if 'include pending' isn't working correctly for you.
Comment #3
dpatte commentedI have a relationship called administrator. Each user (requestee) should be allowed to have up to 1 administrator (requester), but any user (requester) can have multiple users they are administering (requestees).
I cannot see how to handle this with this module, or am I missing something?
Thanks
Comment #4
neograph734The user_relationship_limits_relationship_count() function is called twice to check the requesting user and the requestee user. But the query appears to only check the requesting user as of:
I've managed to improve the check by changing this to:
Which now throws an error if one person requests a relationship where the requestee has reached its limit. BUT only after the entry is stored in the database. Which means that if multiple people request a relationship with the same user at the same time, the check still fails and the requestee still exeeds its limit.
I tried to lock the database with lock_acquire in user_relationship_limits_user_relationships_presave(), and release it in a new function user_relationship_limits_user_relationships_save() which is called after saving the relationship. This however did not work.
The only way I got this to work was by adding
to the beginning of user_relationships_save_relationship in the user_relationship.module and releasing the lock right before the return using
Since the user_relations module does not require locking I doubt we will be able to convince them to include these locks.