WordPress.org

Ready to get started?Download WordPress

Forums

YOP Poll
[resolved] redirect after trying to vote a second time (3 posts)

  1. agent14
    Member
    Posted 5 months ago #

    is it possible to insert a redirect to a webpage if a user tries to vote a second time? instead of just saying error - you already voted?

    thanks.

    https://wordpress.org/plugins/yop-poll/

  2. YOP
    Member
    Plugin Author

    Posted 5 months ago #

    Hi agent14,

    Edit js/yop-poll-public.js and approximately on line 279 you will find

    if ( '' != response.error ) {
    jQuery( '#yop-poll-container-error-' + poll_id + unique_id ).html( response.error );
                    jQuery( '#yop-poll-container-success-' + poll_id + unique_id ).html( '' );
                    popupClose = true;
                }

    Between the braces add

    if( response.error.toLowerCase() == 'you already voted!' ) {
                        window.location = 'new url';
                    }

    so in the end you'll have

    if( '' != response.error ) {
                    if( response.error.toLowerCase() == 'you already voted!' ) {
                        window.location = 'new url';
                    }
                    jQuery( '#yop-poll-container-error-' + poll_id + unique_id ).html( response.error );
                    jQuery( '#yop-poll-container-success-' + poll_id + unique_id ).html( '' );
                    popupClose = true;
                }

    Regards,

    YOP Team

  3. agent14
    Member
    Posted 5 months ago #

    thanks

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.