WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Blocked user message – doesnt show up

[Resolved] Blocked user message – doesnt show up

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author YOP
    Participant

    @yourownprogrammer

    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

    Chuck
    Member

    @meandisis

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

    Plugin Author YOP
    Participant

    @yourownprogrammer

    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

    Chuck
    Member

    @meandisis

    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.

    Chuck
    Member

    @meandisis

    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.

    Plugin Author YOP
    Participant

    @yourownprogrammer

    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

    Chuck
    Member

    @meandisis

    Amazing, thank you!

    Hey,
    I want to add a Text, too. But unfortunately I can’t find the inc/yop_poll_model.php. – Is this solution still up-to-date?

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Resolved] Blocked user message – doesnt show up’ is closed to new replies.