WordPress.org

Ready to get started?Download WordPress

Forums

YOP Poll
[resolved] messages at the end (5 posts)

  1. ceubri
    Member
    Posted 3 months ago #

    Hello,
    is it possible to have the messages like "no answer selected!"
    (the div : yop-poll-container-success / error) at the end of the div, under the vote button ?

    Thx

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

  2. YOP
    Member
    Plugin Author

    Posted 3 months ago #

    Hi ceubri,

    Edit yop_poll_model.php and in return_poll_html() function cut these code lines

    $msgDivS = false;
                            $msgDivE = false;
    
                            if ( strpos( $template, "%POLL-SUCCESS-MSG%" ) != false ){
                                $msgDivS  = true;
                                $template = str_ireplace( '%POLL-SUCCESS-MSG%', '<div id="yop-poll-container-success-' . $poll_id . $unique_id . '" class="yop-poll-container-success"></div>', $template );
                            }
                            if ( strpos( $template, "%POLL-ERROR-MSG%" ) != false ){
                                $msgDivE  = true;
                                $template = str_ireplace( '%POLL-ERROR-MSG%', '<div id="yop-poll-container-error-' . $poll_id . $unique_id . '" class="yop-poll-container-error"></div>', $template );
                            }

    and paste them before

    $template = str_ireplace( '%POLL-VOTE-BUTTON%', '<button class="yop_poll_vote_button" id="yop_poll_vote-button-' . $poll_id . $unique_id . '" onclick="yop_poll_register_vote(\'' . $poll_id . '\', \'' . $location . '\', \'' . $unique_id . '\'); return false;">' . $poll_options['vote_button_label'] . '</button>', $template );

    Next, select

    if ( !$msgDivS ){
                                $template .= '<div id="yop-poll-container-success-' . $poll_id . $unique_id . '" class="yop-poll-container-success"></div>';
                            }
                            if ( !$msgDivE ){
                                $template .= '<div id="yop-poll-container-error-' . $poll_id . $unique_id . '" class="yop-poll-container-error"></div>';
                            }

    and move them after

    $template = str_ireplace( '%POLL-VOTE-BUTTON%', '<button class="yop_poll_vote_button" id="yop_poll_vote-button-' . $poll_id . $unique_id . '" onclick="yop_poll_register_vote(\'' . $poll_id . '\', \'' . $location . '\', \'' . $unique_id . '\'); return false;">' . $poll_options['vote_button_label'] . '</button>', $template );

    Let us know if you need more help.

    Best wishes,

    YOP Team

  3. ceubri
    Member
    Posted 3 months ago #

    Thanks,

    it's works for no answer selected!
    But i have no more : thank you for voting...

    here is my modified code : http://tny.cz/33f14758

  4. YOP
    Member
    Plugin Author

    Posted 3 months ago #

    Hi ceubri,

    To display the message edit yop_poll_model.php and after

    if ( 'after' == $poll_options['view_results'] || 'before' == $poll_options['view_results'] ){
           if ( $this->is_view_poll_results() ){
            $template = str_ireplace( '%POLL-ANSWER-RESULT-LABEL%', $poll_options['answer_result_label'], $template );
           }

    add

    '
    $template .= '<div id="yop-poll-container-success-' . $poll_id . $unique_id . '" class="yop-poll-container-success"></div>';
    '

    Regards,

    YOP Team

  5. ceubri
    Member
    Posted 2 months ago #

    Great !!!
    Thanks :)

Reply

You must log in to post.

About this Plugin

About this Topic

Tags