Active
Project:
User Points Contributed modules
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
12 Jan 2012 at 07:55 UTC
Updated:
4 Feb 2012 at 18:07 UTC
I wanna set the limit of -200 points. Users can donate to other users till this limit. is this possible?
thanks very much
Comments
Comment #1
berdirThis is currently not possible.
Moving over to the correct project and changing to a feature request.
The code that validates the points is below, it would be relatively simple to introduce a variable that allows to configure the limit, defaulting to 0.
Patches are welcome.
Comment #2
kwstasm83 commentedis working!
thank you very much!
Comment #3
berdirIf you make your hack configurable using variable_get() and provide it as a patch, I can commit it and add it as a feature to this module.
Otherwise, your hack will get overridden each time you update the userpoints_contrib module and you will need to re-apply it.
Comment #4
kwstasm83 commentedhi there!
I am quite new in development. I just change a bit the code. I put:
if ($form_state['values']['amount'] > $current_points + 200) {
But if You tell me how to use variable_get() and provide it as a patch or if you drive me to the right tuttorials i promise that i ll work in this.
Thank you
Comment #5
berdirTo make it configurable, you'd need something like this:
Note that I slightly changed the code to make it (IMHO) more readable. In your case, you'd then need to set that variable to "-200". To do that, you need to expose the variable in the existing confirmation form. Have a look at the existing form fields, you simply need to give the new form element the same name as the variable and it will automatically be saved as one. Check out http://drupal.org/node/751826 to learn the basics about building forms in Drupal.
Lastly, you should also add a variable_del('userpoints_donate_minimum') into the uninstall hook, so that the variable is deleted when the module is uninstalled.
Feel free to ask if you have any questions.
Comment #6
edufol commentedHi Berdir,
Thanks for your reply. :)
I would like to make the limit configurable for every user. I created a field for every user (field_ecos_limit) that establish the maximum debit that the user can have.
Is it possible to put the field inside this code?:
Thank you very much for your support. Sorry for my english :)
Eduard