Poll Plugin by iionly

I am new to Developing here and am wondering if there is an easy way to eliminate the functionality of the user to add voting choices.  For what I am trying to do I really only want to have One Set Voting Choice (i.e. Yes).  

Thanks in advance!

Rusty

  • I think it's not very complicated. Edit mod/poll/views/default/forms/poll/edit.php:

    Replace the lines

    <div>
        <label><?php echo elgg_echo('poll:responses'); ?></label>
        <?php echo elgg_view('poll/input/choices', array('poll' => $poll)); ?>
        <?php echo elgg_view("output/longtext", array("value" => elgg_echo('poll:note_responses'), 'class' => 'elgg-subtext mts')); ?>
    </div>

    with

    <?php
        echo elgg_view('input/hidden', array('name' => "number_of_choices", 'value' => 1));
        echo elgg_view('input/hidden', array('name' => "choice_text_0", 'value' => elgg_echo('poll:settings:yes')));
    ?>

    Then it's no longer possible to add any poll choices when creating or eding a poll. Instead a single choice is added automatically. Choice text in this case would be "yes" (language string 'poll:settings:yes'). If you want another text for the poll choice (still always the same text though), you can add the text in the language file(s) and change the string in elgg_echo(). You could also add more fixed choices. Just add another line corresponding to the second elgg_view line above with the number of "choice_text_0" increased and adjust the value of number_of_choices() in the first elgg_view() call.

  • Awesome!!!  I new it had to be fairly easy...  Thank you.