Prevent User from Voting on Own Content

mudanoman - August 7, 2006 - 22:30
Project:Voting
Version:4.7.x-1.x-dev
Component:Miscellaneous
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

Hi,

I was curious if there is a way to prevent the user from voting on his/her own created content.

Thanks,

Ivan

#1

dreamconverter - August 25, 2008 - 16:58

Hi, did anyone respond to you or did you find a way? I have the same issue.

Cheers,

Marco.

#2

dreamconverter - August 25, 2008 - 18:12

Hi I have a quick solution.

Find this bit of code in extra_voting_forms.module and change it as per below. Now user can never vote his/her own content, regardless of type.

// The user can't vote on his/her own comments, return error
// (Note: admin and the karma admin can!)
if ($o->sk_type == 'c' && $account->uid == $o->uid && $account->uid != 1 & ! user_access('voting administrator', $account)) {
return array( t("You can't vote on your own comments!"), 0 );
}

// Change by Marco Nannini
// I am changing the code so that a user can never vote his/her own content
// I simply removed the check on the content type so that now it applies for any content type
// Also changed the comment to be more generic
if ($account->uid == $o->uid && $account->uid != 1 & ! user_access('voting administrator', $account)) {
return array( t("You can't vote on your own content!"), 0 );
}

The only thing left is to find where the module assigns the "grayed out" color to stuff you cant vote on, at the moment, comments have the arrows grayed out, but notes look like you could vote on them...

Cheers,

Marco Nannini.

 
 

Drupal is a registered trademark of Dries Buytaert.