Tell me more ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

good day.

I want to achieve the following functionality and I'm wondering if this could be possible:

For each purchase, one can gain userpoints (I can handle this using Rules).

Those userpoints will then be used to vote nominees. So if I have 1000 userpoints, i can use 300 for Candidate A, 500 for Candidate B, and and 200 for Candidate C. ( 1 userpoint = 1 ballot)

Can some give a hint/suggestion on how I could implement this. Workflow would be:

  1. I select a candidate.

  2. "Input" a vote amount.

  3. Vote gets recorded.

  4. Vote amount will be deducted from my userpoints.

share|improve this question

2 Answers

First of all i think you need to elaborate the question a bit more. And as far as i understand your question, you can do this using flag, you can provide the user some flag to vote and set a rule where the nominee will be donate the vote from his points when the flag is flagged. Hope it helps

share|improve this answer
Thanks. I'll try to make it more clearer. :) I need "Userpoints" in order to vote for a candidate/node. (And I can only be granted userpoints when I purchase products. $1 - 1point) <- Could be easily done using Rules. Now for instance, I have 300 points, and I'd only like to give 233 points to Candidate A and 67 points to Candidate B, how do I go through with this? With flags, isn't it only limited to a single vote/unvote per user? I'd like to have the functionality to "Input" a "desired amount of votes" to a candidate/node. With the deduction of userpoints,I could do this with Rules also. – rareglove99 Apr 3 at 8:05

So according to your desired workflow. You can follow these steps:

  1. Create a drupal form having two fields 'select candidate' and 'input vote'.

  2. Now check if input vote < userpoint.

  3. And if yes on form submit record the vote and grant nominee points and deduct from the logged in user. You can use form_rules to trigger a rule on form submit or validate or alternatively you can use userpoints api to grant or deduct points.

  4. And if no , show the user a message that user don't have enough points.

share|improve this answer
Thanks for your replies nit3ch. But what would be the "field/widget" used in the "input vote" field? (Because i need to retrieve the data for monitoring of who is leading/winning and show it as a real time graph/poll) Do i need additional modules/APIs? I already looked into a lot of voting modules like Rate, Fivestar, Poll, and similar modules but all of them does not have the functionality to input a "desired amount of votes" (Maybe trying to find solutions by using "voting" modules is not the right track to solve this special "voting" functionality). I Really appreciate your time on this. – rareglove99 Apr 4 at 0:37
you can use custom int field and also you can retive data using view and show it as a graph.Since user is just donating their userpoints to nominee so it is easier to find the leading nominee on the basis of points. – nit3ch Apr 4 at 6:05
Let me clarify if this is what you mean. Add an "integer" field to the form as the "Input vote" field, then since it is a form, I should be able to collect all the votes when a user "submits" his votes. Is that what you mean? (I have no problem with making the monitoring/graphing functionality) – rareglove99 Apr 4 at 6:16
Btw, is it possible to reference nodes to webforms? Since I will need to create a content type to encode all the candidates (might reach a hundred). And based on your suggestion, I'm assuming that I could just assign the "Inputted vote" to the selected candidate in the form? – rareglove99 Apr 4 at 6:23
when the user input vote they are actually donating userpoints to the nominee, the input vote (userpoints) is deducted from the user on form submit, granting and deducting userpoints can be done using userpoints_api as i stated earlier.So the nominee having maximum userpoints is the winner.Hope i am clear enough this time. :) – nit3ch Apr 4 at 6:26
show 3 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.