Integration with Rules

vivianspencer - November 3, 2008 - 19:51
Project:Node Vote
Version:6.x-1.x-dev
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:needs work
Description

Hi, great module

I needed a way to support the following use cases:
1. Registered Users can vote on images
1. When the maximum number of votes needed has been reached the average vote is assessed; if it is greater than the average needed to pass review then the image is added to the accepted images page otherwise it is deleted.
2. The administrator has the ability to change the number of votes needed
3. The administrator has the ability to change the average needed to pass

I tried using the following combination: Voting API, Voting Actions, Vote Up/Down, but couldn't get them to work properly, plus no drupal 6 version.

What I decided in the end was to make some modifications to the nodevote module, here's a list of the modifications I made:
1. Added a variable which sets a limit on the maximum number of votes allowed
2. Added a variable which sets the average vote needed, this variable depends on Rules as it links in with the conditions created for it
3. Added a feature which allows any node to hide the nodevote widget; I wanted the user has to have permission to do so, so I created a new permission 'hide nodevote'
4. Integration with the Rules module, which includes the following:
a. Reached maximum votes Event
b. Above average Condition
c. Below average Condition
d. Clear votes Action
e. Hide Nodevote Widget Action
f. Show Nodevote Widget Action

I also optimised the code using the coder module and added the variables created with this module to the hook_uninstall function for better cleanup

I've attached the updated module as a zip file for now (just until I learn how to create patches), I haven't fully tested all the changes but everything seems to be working fine for my usage

Future changes could include the possibility to change the max/average number of votes for each node type rather than for all node types

AttachmentSize
nodevote.zip7.35 KB

#1

kbahey - November 3, 2008 - 20:28
Status:needs review» needs work

.zip files are not suitable for reviews.

If you want this to get reviewed and possibly included in the base module, then please visit http://drupal.org/patch and follow the instructions on how to create a properly formatted unidiff patch.

It should be against the -dev version.

#2

vivianspencer - November 4, 2008 - 19:37

"I've attached the updated module as a zip file for now (just until I learn how to create patches)"

#3

vivianspencer - November 4, 2008 - 20:26
Version:6.x-1.0» 6.x-1.x-dev

Ok, here's the patch

It is the first time I've submitted a patch so if there are any problems please let me know and I'll try and fix it

AttachmentSize
nodevoteNew.patch 23.56 KB
 
 

Drupal is a registered trademark of Dries Buytaert.