Currently:
Upvote = +1
Downvote = -1

I need to be able to vote multiple times. I am creating a voting currency, where users are able to vote 10 times on a specific content type and may upvote 5 times for a specific node/entity

I believe this feature will be useful for other modules, such as Userpoints.

Brainstorm Solution:

  1. Add checkbox to field settings. If checked, then voting is a currency. IE. Downvote (-1), Upvote (0), Upvote (+1).
  2. Add 2 Constants to the module. DEFAULT_HIGH_VALUE = 1, DEFAULT_LOW_VALUE = -1
  3. Add 2 Textfields to field settings. One to set the high value. One to set the low value. When you create the vud_field, they will default to DEFAULT_HIGH_VALUE & DEFAULT_LOW_VALUE.

In Code:

  1. Add entity value check in vud_vote() (in vud.theme.inc)(call function to query grab $entity_id currency checkbox value)
  2. Change
         // vud.theme.inc line 200ish
          $up_access = $user_vote <= 0;
          $down_access = $user_vote >= 0;
    

    to Final solution might be simplier than this

          $high_value = isset(entity_load($entity_id)['high_value']) :  entity_load($entity_id)['high_value'] ? DEFAULT_HIGH_VALUE;
          $low_value = isset(entity_load($entity_id)['low_value']) :  entity_load($entity_id)['low_value'] ? DEFAULT_LOW_VALUE;
          $up_access = $user_vote < $high_value;
          $down_access = $user_vote > $low_value;
    
CommentFileSizeAuthor
#3 multi-vote-1869790-3.patch13.45 KBistryker

Comments

marvil07’s picture

Status: Active » Closed (won't fix)

Sorry, IMO it's out of the scope of the module.

At first look I tough this can be done from a custom widget, but since we are using entity id as part of the votingapi vote being casted, it's not currently possible to do multiple votes on the same entity. There will be a way to by pass it after #813534: +N/-N votes on widgets, but without the historical information.

So, I am closing this as won't fix.

For this case, maybe it worths to use votingapi directly.

istryker’s picture

Status: Closed (won't fix) » Active

Yes it can, I am working on a patch. That is why I assigned it to myself. The patch should be fairly straightforward, and should not conflict with how the module works currently. The only thing I am worried about is the UI, which I will need feedback on.

istryker’s picture

Status: Active » Needs review
StatusFileSize
new13.45 KB

Here is the patch. It wasn't as straightforward as I thought it would be as the amount of variables pass during the ajax calls are very minimal.

Status: Needs review » Needs work

The last submitted patch, multi-vote-1869790-3.patch, failed testing.

istryker’s picture

Status: Needs work » Needs review

#3: multi-vote-1869790-3.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, multi-vote-1869790-3.patch, failed testing.

istryker’s picture

Status: Needs work » Needs review

Moving to needs review, I don't know why it failed simple test. Is/Was it broken? There is a vud.test file that should've ran.

istryker’s picture

#3: multi-vote-1869790-3.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, multi-vote-1869790-3.patch, failed testing.

istryker’s picture

Status: Needs work » Needs review

#3: multi-vote-1869790-3.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, multi-vote-1869790-3.patch, failed testing.