WordPress.org

Ready to get started?Download WordPress

Forums

Ajax Function: Once Per User Per Post (1 post)

  1. nickbudden
    Member
    Posted 2 years ago #

    Hello,

    I'm calling a voting function via admin ajax, and this function stores a user's ID and post ID in a custom table called "votes", in order to ensure that a user can't vote more than once per post.

    Just before inserting a new vote I query this custom table to make sure that they haven't already voted, which works perfectly when there is a reasonable amount of time between votes. The trouble is when they click the voting button really fast many times. This seems to get around my check by initializing my voting function several times before any records exist in my custom voting table.

    Is there a better way to ensure that each user can vote only one time?

Topic Closed

This topic has been closed to new replies.

About this Topic