Closed (fixed)
Project:
Vote Up/Down
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
9 Aug 2010 at 02:41 UTC
Updated:
24 Feb 2012 at 17:00 UTC
Jump to comment: Most recent file
Comments
Comment #1
cpliakas commentedThe attached patch adds a hook_vud_access() hook modeled after the Flag module's hook_flag_access(). There is also a hook implementation in the vud_node() module that allows for users to select "One time voting" restrictions so they cannot vote more than once.
Comment #3
cpliakas commentedCommitted an older patch in #1. The attached patch is the most recent and takes vud_comment and vud_term into account. Will work on unit tests.
Comment #4
marvil07 commentedThe patch is clean, but IMHO this is out of the scope of the module.
I would suggest to implement that functionality at the widget level, showing the voting control only when needed. I am willing to move more interaction to the widget in the future, but definitely not for the actual 2.x stable branch.
Comment #5
cpliakas commentedHi marvil07.
Thanks for the feedback. First, I should have patched this against 3.x, I agree with you that it shouldn't be in the 2.x stable branch since it is a significant change. Regarding preventing voting by the widget, my opinion is that it should not be handled on the display layer. The reason is that you should be denied access to vote as opposed to the widget just hiding the voting options. Furthermore, preventing voting via a universal access callback allows you to have the changes reflected across all widgets, so your logic isn't determined solely in the presentation layer. Looking at some of the voting features we want to implement in Drupal Commons, we would most likely have to override the menu callback and implement an access hook which is a viable solution, but it would be cool if we could get this code into the core module.
Thanks for a great project, big fan of the work you have done on it.
~Chris
Comment #6
marvil07 commentedThinking this a little more, I notice this could help to achieve #554360: Disallow Voting on Your Own Content from another module, so re-opening this.
In the other side, I think we only want the hook declaration, I mean, not the hook implementation inside any of the modules.
Comment #7
cpliakas commentedHi marvil07.
Sounds good, and thanks for taking the time to consider this further. Also, I agree with you that there probably shouldn't be any hook implementations inside of the module. Leaves room for contribs and custom mods to fill that space.
Thanks again,
Chris
Comment #8
cpliakas commentedAccidentally reverted tags... changing back.
Comment #9
cpliakas commentedRe-rolled patch against the 6.x-3.x-dev version of the module. As requested in #6, it includes only the hook definition and no implementations.
Thanks,
Chris
Comment #11
cpliakas commented#9: vote_up_down-877392-9.patch queued for re-testing.
Comment #13
ressaIt would be really great to be able to prevent users from voting on own content, so I hope this patch passes the test soon 8o)
Comment #14
marvil07 commentedThis accidentally implements hook_access(), so changing the name would be better.
minor bug here, the comparison if against $account variable.
Powered by Dreditor.
Comment #15
udvranto commentedAny update on this?
Comment #16
cpliakas commentedRe-rolled patch based on comments in #14.
Thanks,
Chris
Comment #17
marvil07 commentedI finally returned to this \o/. Committed to 6.x-3.x. Thanks for the patience here!
I have just changed the way of the hook, the behaviour now is deny access if:
In other case, allow. IMHO that's more clear to read.
I have also made some tweaks here and there. Attaching the patch I am going to commit and the interdiff patch for people here since the last patch ;-)
Moving status to port(not sure if in exactly the same way) it to the 7.x version when possible.
Comment #18
marvil07 commentedsorry, forgot to attach the patches for convenience :-p
Comment #19
cpliakas commentedThanks for getting back to this and posting your modifications. I think this will help in building ideation solutions similar to ideascale and quora.
Comment #20
klonos...and if anyone manages to put something together based on this that solves #1201938: How To: Disallow voting on your own content (script or unofficial sub-module or whatever), please post it here or there so we can finally close that one too. Thanx.
Comment #21
vonderro commentedSo, in Drupal 6 version, how can I deny voting on user's own content, can anyaone help me with this?
Comment #22
marvil07 commented@vonderro: You can do it using hook_vud_access().
Comment #23
marvil07 commentedThe attached patch is now on 7.x-1.x.
From commit message: