WordPress.org

Ready to get started?Download WordPress

Forums

YOP Poll
[resolved] Minimum multiple answers to a poll (3 posts)

  1. arazavi
    Member
    Posted 1 year ago #

    I've setup a Poll where I want voters give exactly 3 answers.
    While the plugin restricts the maximum number of answers by default, is there a way to restrict the minimum number of answers to 3 as well?

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

  2. YOP
    Member
    Plugin Author

    Posted 1 year ago #

    Hello

    To get this to work, you will need to do some edits to the code.

    First, update your poll to allow multiple answers and also define the number of answers you want.

    Then on inc/yop_poll_model.php on line 2437 replace

    if ( count( $request['yop_poll_answer'] ) <= intval( $poll_options['allow_multiple_answers_number'] ) ) {

    with

    if ( count( $request['yop_poll_answer'] ) == intval( $poll_options['allow_multiple_answers_number'] ) ) {

    In the same file, on line 2468 you need to change the error given.

    Replace

    $this->error = __( 'To many answers! Only ', 'yop_poll' ) . $poll_options['allow_multiple_answers_number'] . __(' answers allowed!', 'yop_poll' );

    with

    $this->error = __( 'At least ', 'yop_poll' ) . $poll_options['allow_multiple_answers_number'] . __(' answers needed!', 'yop_poll' );

    Give it a try and let us know if this does what you need.

    Best Regards,
    YOP Team

  3. arazavi
    Member
    Posted 1 year ago #

    Hi!

    I had figured this solution just after I posted the question.
    It works just as expected. Thanks for the prompt reply and a wonderful plugin.

    Cheers.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.