• Resolved anthonious

    (@anthonious)


    Hello,

    last question on my part. I hope so. Our discussion forum is closed to logged-in users only. I would like to know whether the vote is fixed to users, cookies or an IP address (I think that is what it is). The users of our forum are from larger organizations and several users can vote on the same IP address.

    I was testing and another user on the same IP cannot vote on a post that someone has already voted on.

    Thanks for explaining how it really is.

    And thanks for the quick reactions and so far quick solutions ??

    • This topic was modified 5 years, 4 months ago by anthonious.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author natekinkead

    (@natekinkead)

    Previously, I was using a cookie to stop subsequent votes from the same browser. But, the problem with that is that it is too easy for anyone to just keep deleting the cookie and voting as many times as they want.

    That’s why I switched to the IP method.

    But, now that you mention it, there was still that gap, especially with large organizations.

    So, I just released an update.
    = 1.2.2 =
    * Added vote tracking by user ID when logged in and fallback to IP when not logged in.

    Thread Starter anthonious

    (@anthonious)

    Hello @natekinkead,

    thank you very much. I haven’t seen such great support yet.

    Anthonious

    Plugin Author natekinkead

    (@natekinkead)

    You’re welcome!

    I”d love to see this linked to Roles, where only users of a certain role could vote, and then limit them to one vote per user ID based on whether they are in the correct role.

    Plugin Author natekinkead

    (@natekinkead)

    Hi @ricks03,

    You can use one of the hooks available to accomplish this very easily. For instance, you can use the ‘bbp_voting_allowed_on_forum’ hook, and while it passes the forum ID, you don’t have to use it, but instead you can check the user’s role.

    So, if you wanted to only allow users with the role ‘subscriber’ to vote, you would add this code to your functions.php file…

    add_filter( 'bbp_voting_allowed_on_forum', 'allowed_voting_forums', 10, 2 );
    function allowed_voting_forums( $allowed, $forum_id ) {
        if( current_user_can('subscriber') ) {
            $allowed = true;
        } else {
            $allowed = false;
        }
        return $allowed;
    }

    Interesting. Thanks!

    • This reply was modified 5 years, 2 months ago by ricks03.
    Plugin Author natekinkead

    (@natekinkead)

    Glad to help!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Voting fixed to users, cookies or IP’ is closed to new replies.