I just created a new project for the Node vote module.

It allows users with the appropriate role to vote of nodes, assigning each a score from 1 to 10. By design, users do not see the score for a node untl they have voted but that could be changed if needed.

More in the Node Vote module.

Comments

boris mann’s picture

Khalid, can you maybe do a write up explaining the extended commerical version concept? I find it very intriguing, and think it fits well within the general model of open source, and would like to hear your take on it.

kbahey’s picture

Hi Boris

Here is the writeup.

http://drupal.org/node/25412

Feedback welcome there.

--
Consulting: 2bits.com
Personal: Baheyeldin.com

--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba

jasonwhat’s picture

Why was a new module created instead of extending the node moderation module that already exists? That allows admin complete control over voting procedures and even different vote weights per role. Maybe admin only wants 1 or 2 voting options, maybe admin wants them named instead of numbered. Now there are two separate modules that basically do the same thing, but each has features that the other module could use.

kbahey’s picture

When I was approached by the client for that module, I thought about Node Moderation, and pointed it out to them.

They said it did not do what they wanted, so I wrote a new one to do exactly what they want.

This is why you will see some features that are "unique", for example, users do not see the voting score until they themselves vote! This is to prevent them from being biased by what others say, as well as an incentive for them to vote.

--
Consulting: 2bits.com
Personal: Baheyeldin.com

--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba

boris mann’s picture

Also, node moderation's main goal is not voting, but moderation -- i.e. determining whether to promote/demote.

moshe weitzman’s picture

thats just the current implementation. we could just as easily take no action or different action upon scores hitting a threshold. very little code concerns itself with promote/demote.

i too, would like to see these 2 modules joined. its OK that you wrote a new one for a client. its not especially good that you decided to contribute a module which largely duplicates an existing module, especially without even trying to combine the two. lets do that now.

kbahey’s picture

Just to make things more interesting for all of us, yet another voting module was posted to Drupal's repository.

http://drupal.org/node/25640

Now we have to merge three modules, not just two! (My brain hurts).

--
Consulting: 2bits.com
Personal: Baheyeldin.com

--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba

benshell’s picture

It would certainly be ideal to have a single module that combines all three of our voting systems, but the reason I made mine was because I was confused by nmoderation and the queue module. I didn't need moderation, I just want a nice looking form that would be easy for the users.

I didn't try node_vote until now, because it is new. However, I think it's too difficult for the average user. For example, I don't think the user should ever be confronted with the word "node". They don't know what that is.

Also, people don't like reloading the page they are on. I used to use a select box for voting on my site, but very few people ever voted. I asked some people why and they said it was because it was too hard. Even though the voting script took them right back to the page they were on, it was too cumbersome for most people. This is why I wrote my voting form in Flash. It's a five-star system where you mouseover the stars and click. It's simple and fast. Such a system could also be written with AJAX (Asynchronous JavaScript and XML) like Yahoo News.

My module also provides fine tuned control over where the voting form shows up (as does nmoderation) and it can be used for content that is not node based. That may not be critical, but I thought it could be useful. For example, if it were used for moderation in the future, I think node moderation and comment moderation should look and work the same.

Anyway, with that said, I'll definitely support an effort to consolidate the systems. I'd even be okay with a complex administration system as long as it is simple and graphical for the users.

kbahey’s picture

I didn't need moderation

Me neither. The fact that nmoderation has "moderation" in its name is confusing, and made my client decide they want a new custom module.

I didn't try node_vote until now, because it is new. However, I think it's too difficult for the average user. For example, I don't think the user should ever be confronted with the word "node". They don't know what that is.

True. But that can all be changed in the translation. My client will do that, and change it to "image" since that is what they will be using it for.

Also, people don't like reloading the page they are on. I used to use a select box for voting on my site, but very few people ever voted. I asked some people why and they said it was because it was too hard. Even though the voting script took them right back to the page they were on, it was too cumbersome for most people. This is why I wrote my voting form in Flash. It's a five-star system where you mouseover the stars and click. It's simple and fast. Such a system could also be written with AJAX (Asynchronous JavaScript and XML) like Yahoo News.

For my client, they are an art/photography site, and voting is a very common thing to do for these sites. Moreover, there is an incentive to vote, since the user points module gives the user points when they do so. Also, the overall result of the vote will be hidden until they themselves vote, providing more incentive to do so.

Regarding using Flash, I have to say that this is among the best uses of flash that I have ever seen anywhere. It is also nice looking and easy to understand.

I myself do not like Flash, since it is mostly misused on the web, and not everyone has it turned on. I turn it off to get rid of the ads that eat up memory and slow my PC while browsing.

In this case, it is an exception and I like it. I would prefer AJAX though, provided that the look and feel is comparable.

Anyway, with that said, I'll definitely support an effort to consolidate the systems. I'd even be okay with a complex administration system as long as it is simple and graphical for the users.

Me too. I would like to see all of them merged.

Of course, my client will stay with nodevote, because they have the extended version which allows rating a node (image in their case) on more than one dimension.

--
Consulting: 2bits.com
Personal: Baheyeldin.com

--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba

Arto’s picture

Hopefully Ajax functionality is on its way into Drupal with Google's JS libraries and the Summer of Code projects. If they can make as easy to use, from a developer's viewpoint, as the Ajax functionality in Ruby on Rails, I could see it becoming a standard way of creating user interfaces for Drupal.

vph’s picture

I've installed this module and encountered the following problem. Only login users can vote/view the rating, despite my allowing anonymous users to access and view notevote's. Is this the way it is designed or I'm missing something?

Thanks.

Vph

kbahey’s picture

Yes, this is by design.

It cannot be easily changed, since each node has a record of who voted for it, and if we allow anonymous to vote, then only the first anonymous person to vote will be able to do so. It also opens the door to abuse (someone can log out and vote on his own node, giving it higher score).

--
Drupal development and customization: 2bits.com
Personal: Baheyeldin.com

--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba

vph’s picture

Thanks. I understand the design and it is reasonable.

But, I'm also talking about the "view" aspect (not just the "vote"). Is it by design that anonymous people cannot view the rating? This is the main problem I have. Unless someone logs in, he/she can NOT view the rating of a post (in this case "recipes"), and doesn't even know that such a rating exists as there's no indication. Our site expects alot of passing-by users, who may not be interested in logging in or even registering. Inspite of that, I'd like them to be able to "view" the ratings.

Thanks,

VPh

boris mann’s picture

In any online community that is high traffic, much more of the traffic will be anonymous than registered.

DarkAngel@fun-sg.com’s picture

i agree with that ......
it would be nice to have a feature to enable anonymous voting

kbahey’s picture

Anonymous can now view votes if the permissions are set by the admin.

There is no way to have anonymous votes in this module. The reasons are detailed below.

--
Drupal development and customization: 2bits.com
Personal: Baheyeldin.com

--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba

benshell’s picture

In voting.module, anonymous users can vote if they are granted the "vote on content" permission. Similar to node_vote, the database stores every vote individually, so the user ID is set to 0 for anonymous votes. It uses a combination of cookies and IP address checking to try and stop an anonymous user from voting twice. As long as they have the cookie, they can't vote again. And even if they delete the cookie, they can't vote again for 24 hours from the same IP address.

In many ways I'd rather use the approach kbahey took with node_vote. The votes are of less value if they are anonymous. Users can't be given points, or recommendations, if they vote anonymously. However, I decided to make anonymous voting an option because on my site I'm having a hard enough time getting people to vote at all, so I wanted to make it as easy as possible.

kbahey’s picture

I realize that on a relatively low traffic site, restricting voting to only registered users will result in very few votes. Hence I recognize the need for anonymous to vote.

Use of IP addresses is a problem also, since many ISPs and even entire countries are behind a few IP addresses because of proxies. If your site has a lot of audience from such an ISP or country, then this is a big problem.

Singapore, UAE and Saudi Arabia come to mind, I am sure there are others.

The ISP problem is partially solved since their proxies often disclose the originating IP address.

Still, I have a friend who cannot post to high traffic web site because the site says he has been blocked, while in fact it is the proxy that he is behind that was blocked, because of a worm/bot or something.

Back to nodevote: The reason I designed it this way (votes only for registered users, votes only visible to those who voted) is client requirements: they wanted an incentive for people to vote (they get to see what others have voted, only if they vote), their votes are not tainted by what others have voted, as well as users gaining points for voting.

Anyway, based on public demand, I did modify the module to allow anonymous to view votes (and any other user whose role allows "view nodevote"), with an option for old behavior if so desired.

Enjoy.

--
Drupal development and customization: 2bits.com
Personal: Baheyeldin.com

--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba

kbahey’s picture

Based on the requests above, and a feature request http://drupal.org/node/26057 for this, I have added an option for users to see votes even if they did not voted.

This is now the default behavior. The old behavior now has an option to turn it on (votes only visible to those who voted, and the node owner).

I hope this is better for most users.

Wait till tomorrow to get the new tarball for 4.6.

--
Drupal development and customization: 2bits.com
Personal: Baheyeldin.com

--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba

bslade’s picture

The nodevote module is working nicely for me (see progressivereader.org), but for the most popular block, it displays a title of "Highest Rated Nodes". I'm concerned that website visitors will not know what a node is in this context.

So, I created my own custom block titled "Recent Most Popular Stories" using the following code (mostly copied from the module's _block hook):

$sql=db_rewrite_sql('SELECT n.nid, n.title, AVG(vote) AS av_avg FROM {node} n, {nodevote} nv WHERE n.nid = nv.nid and n.created>".(time()-604800)." GROUP BY n.nid ORDER BY av_avg DESC ');
$content = node_title_list(db_query_range($sql, 0, 5));
print $content;

This block pulls the most popular stories for the past week.

Ben in DC