Closed (fixed)
Project:
User Relationships
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
2 Aug 2009 at 10:42 UTC
Updated:
13 May 2010 at 19:03 UTC
Jump to comment: Most recent file
Comments
Comment #1
alex.k commentedHi, there's nothing in UR preventing this possibility, but it would have to be a custom addition to the module.
Comment #2
mrf commentedI am working on a project where I needed this functionality as well. I've attached my progress so far.
I'm running into one problem that has me stuck. Using the user relationships API how can I stop the current initiated request and give the user an error message? I'm able to output an error message correctly (line 44 of the module), but the request still goes through the system as if nothing happened. I've tried out both 'presave' and 'request' but neither option seems to allow me to stop the request.
Any help would be much appreciated.
Comment #3
YK85 commentedIt would be awesome to be able to "limit the number of pending requests at any give time to x" as well.
I look forward to your work!
Comment #4
mrf commentedHi yaz, I think that limiting the number of pending requests could definitely be useful. Right now I can't think of a good way to add that functionality in without confusing the user about what this module does. Would you expect the pending requests to be counted in the total number of requests (in the current version they are), or would this be a separate number that didn't affect the total number of allowed relationships?
I came up with a solution to my problem in #2, and new requests are now aborted if you have hit your limit.
Anyone that is interested, please try out the module and let me know if you come across any issues.
Comment #5
mrf commentedComment #6
YK85 commentedhi mrf,
I will definitely test out your module this weekend and will report back with any issues if I come across any. I think the name of your custom module "user_relationship_limits" is great and covers all aspects.
Below are some features that I think would be great:
1) limit for total number of approved relationships a user can have (by role) <= i believe you already have this
2) limit for total number of pending requests sent
3) limit for total number of pending requests received
4) limit for total number of pending requests sent and received (sent and received requests combined at any given time, choosing this should disable 2 and 3 above)
For the above, allowing admin to choose a # or unlimited for each setting would be great!
I hope you will be further developing your custom module and look forward to following your work.
Thank you
Comment #7
introfini commentedsubscribing
Comment #8
artscoop commentedHi,
Saving the settings form does not work with the module provided in #4, because of the db_rewrite_sql scattered in the code.
Removing them is ok, but it won't prevent anything from happening (I use the JS popup).
Well, I found some other errors in the code, I'm just going to give the correct code with the lines :
Circa line 31 :
if ($max_limit == 0) {At this line the inner code block was never executed.
Circa line 42 :
if($rel_number >= $max_limit) {At this line the code said that if you want 11 relations max you will have 12 available.
Comment #9
artscoop commentedWell folks, here is the gz file.
Comment #10
mrf commentedThanks for taking a look artscoop.
I made one more change. On line 31 the check was meant to skip the sorting if we had already set $max_limit to unlimited value of 0 in line 27. I feel like the logic with unlimited relationships is convoluted and welcome any suggestions to make handling the unlimited possibility more clear.
Here's the module with that change made to line 31.
Comment #11
alex.k commentedThat's a nice implementation of this feature. I took the liberty of simplifying the check for unlimited per your comment above, pls have a look at the attached. The change is all in user_relationship_limits_user_relationships.
I would suggest you host it as a stand-alone module rather than include in UR proper. It will make things easier as far as managing the issue queue and also the UR package won't grow too big with so many additional modules that not all sites need.
Comment #12
mrf commentedI followed alex's suggestion and created a new project for this module. I'll be putting up the first dev release soon. Feel free to submit any additional patches or related feature requests over there.
http://drupal.org/project/user_relationship_limits
Comment #13
alex.k commentedGreat, let me know when you are ready and i will add a link to your module.