WordPress.org

Ready to get started?Download WordPress

Forums

YOP Poll
[resolved] Blocked user message - doesnt show up (8 posts)

  1. Chuck
    Member
    Posted 3 months ago #

    Hi,

    I am having an issue where once the user voted and our settings are this (http://imgur.com/MDdP9Jb)

    We do not see any message. It is blank. Where can we insert a message here? Shouldn't there be a message that says the user already voted?

    You can try it here: http://www.mtlblog.com/poll-test-page/

    Thanks for your help!

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

  2. YOP
    Member
    Plugin Author

    Posted 3 months ago #

    Hi Chuck,

    You can edit inc/yop_poll_model.php and in register_vote function you can replace the message in
    $this->error = __( 'You Already voted!', 'yop_poll' ); with a custom message.

    Regards,

    YOP Team

  3. Chuck
    Member
    Posted 3 months ago #

    I already tried that- the message doesnt appear. Did you try it on our site?

  4. YOP
    Member
    Plugin Author

    Posted 3 months ago #

    Hey Chuck,

    Do you want that message to be displayed after the user has clicked on Vote or should it come up when the poll is displayed ?

    YOP Team

  5. Chuck
    Member
    Posted 3 months ago #

    The message should be displayed when the poll is displayed (not after the person voted, we already tell them to come back to vote tomorrow in the Success message).

    Right now it just displays the Question without any error message... which is very confusing for the user.

  6. Chuck
    Member
    Posted 3 months ago #

    I did a few tests and the voting options only disappear when we "resave" the page/post where the Poll is in.

    If I create a new poll, insert it in the page and then go vote, it will give me the error "You have already voted!".

    When I go back to the Edit mode of the page, resave, and then reload the page, the poll answers will disappear without any text or error.

  7. YOP
    Member
    Plugin Author

    Posted 3 months ago #

    Hi Chuck,

    If you defined %POLL-ERROR-MSG% in your template then edit inc/yop_poll_model.php and in return_poll_html function replace

    $template = str_ireplace( '%POLL-ERROR-MSG%', '<div id="yop-poll-container-error-' . $poll_id . $unique_id . '" class="yop-poll-container-error"></div>', $template );

    (on line 3109) with

    if( !$is_voted ){
    $template = str_ireplace( '%POLL-ERROR-MSG%', '<div id="yop-poll-container-error-' . $poll_id . $unique_id . '" class="yop-poll-container-error"></div>', $template );
    }
    else {
    $template = str_ireplace( '%POLL-ERROR-MSG%', '<div id="yop-poll-container-error-' . $poll_id . $unique_id . '" class="yop-poll-container-error">You already Voted</div>', $template );
    }

    If you did not define %POLL-ERROR-MSG% in your template then in the inc/yop_poll_model.php function replace the content of if ( !$msgDivE ){ } (approximately on line 3138) with

    if( $is_voted ){
    $template .= '<div id="yop-poll-container-error-' . $poll_id . $unique_id . '" class="yop-poll-container-error">You already voted once! Come back Tomorow</div>';
    }
    else {
    $template .= '<div id="yop-poll-container-error-' . $poll_id . $unique_id . '" class="yop-poll-container-error"></div>';
    }

    Best wishes,

    YOP Team

  8. Chuck
    Member
    Posted 3 months ago #

    Amazing, thank you!

Reply

You must log in to post.

About this Plugin

About this Topic