WordPress.org

Forums

YOP Poll
[resolved] Number of people who did not vote yet (3 posts)

  1. corijn87
    Member
    Posted 1 year ago #

    Hi,

    I want to create a YOP poll and use it for an election.
    A hundred users inside the company are qualified to vote.
    At the results, I want to let show the number of people
    who did not vote yet.

    For example:

    # I choose Ford as supplier for company cars (50 votes)
    # I choose Chevrolet as supplier for company cars (25 votes)
    # People who did not voted yet (25)

    Is this possible at YOP Poll?

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

  2. YOP
    Member
    Plugin Author

    Posted 1 year ago #

    Hi corijn87,

    Edit the template you used for your poll and in "Template Before Vote" and "Template After Vote" sections, after <div>%POLL-TOTAL-VOTES%</div> add

    <div>%POLL-TOTAL-VOTES-LEFT%</div>

    Next, edit inc/yop_poll_model.php and look for this function: return_poll_html(...

    After
    if( 'yes' == $poll_options['view_total_votes'] ) {
    $template = str_ireplace( '%POLL-TOTAL-VOTES%', $poll_options['view_total_votes_label'], $template );
    $template = str_ireplace( '%POLL-TOTAL-VOTES%', $poll_details['total_votes'], $template );
    }

    add
    $people_left_to_vote = 100 - $poll_details['total_votes'];
    $template = str_ireplace( '%POLL-TOTAL-VOTES-LEFT%', sprintf( __('People who did not voted yet (%d)', 'yop_poll'), $people_left_to_vote ) , $template );

    where "100" (people_left_to_vote = 100) shows how many users are qualified to vote.

    Best wishes,

    YOP Team

  3. corijn87
    Member
    Posted 1 year ago #

    Hi YOP Team,

    Thanks for the quick reply.

    It works fine :)

    Many thanks for your support !

    Greetings.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic