logo

Palette - Make it Colorful🎨

Palette - Visual Page Builder, no design degree required.

Live Demo Download Palette

Scroll

Vote limit for anonymous users

22/02/2025, by Anonymous (not verified)

Hello.

Please let me know if there is a way to set a limit for anonymous users on the number of votes they can cast.

For example, there is a gallery of images, but I need the anonymous user to be able to vote for only one image - that is, just once.

 

 I tried to do it like this:

$curip = ip_address();
$result = db_query("SELECT count(vote_source) as 'count' FROM {votingapi_vote} WHERE vote_source = '$curip'");
$fetch = db_fetch_object($result);
$count = $fetch->count;

Then I tried to use it in the voting.module file and thumbs-up.tpl.php, but it doesn't work - I'm getting a server error

 

 Please advise, thanks