Hide voting box after user votes

blue car - December 20, 2006 - 23:35
Project:Node Moderation
Version:4.7.x-1.x-dev
Component:User interface
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

Would it be possible to include a feature in node moderation so that after a user has voted on a story in the moderation queue, they no longer see the voting controls when they view that story? I don't want users to be able to change their votes after they have voted, and I don't want the voting controls cluttering up the story page when they are no longer needed. Does anyone have any suggestions? Many thanks!

#1

blue car - December 22, 2006 - 10:02
Version:HEAD» 4.7.x-1.x-dev

Well, I compromised by removing the voting box from pages after they have been promoted, and disallowing negative votes. I added the code "&& ($node->promote != 1) " to the function nmoderation_is_votable as one of the conditions in the $access= expression. So after the nodes are promoted voting is no longer enabled on them. I think it would be nice if there was a checkbox option in the nmoderation settings to allow this behaviour and to allow hiding the form after a user has voted. I am completely new to php so couldn't really code that myself.

#2

blue car - December 22, 2006 - 12:17

After making the amendment above I realised I had to clean up the moderation queue as well, since for users who hadn't voted on a story, stories which had already been promoted to the front page were still visible in the moderation queue. So I changed the sql query which shows the moderation queue by adding the condition WHERE n.promote = 0, this seems to work by not showing stories in the queue which have already been promoted.

(P.S. When I said earlier that I had disabled negative votes, what I meant was that there is only one vote available, promote to front page, therefore it doesn't matter that the voting box remains after voting as there is no way to edit the vote, because there is no other vote to change it to.)

#3

blue car - December 23, 2006 - 21:22

Well, I've continued hacking away at the module and I've managed to make the changes I wanted for my own purposes, but there is no UI for the new behaviour as that is beyond my abilities, unfortunately.

1. After a user votes on a story they will no longer see the voting box on that story
2. However, after a user votes on a story it will still be visible in their moderation queue, so they can follow any discussions taking place whilst the story is still in voting
3. The voting form disappears for everyone after the story is promoted

I'm attaching the modified file in case anyone's interested.

AttachmentSize
nmoderation.module 29.63 KB
 
 

Drupal is a registered trademark of Dries Buytaert.