Function __global->cns_validate_poll

Definitions

sources/cns_polls_action3.php

  • Warn_exit on any invalid poll answers. Also enforces poll options via parameter return by reference where applicable.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$topic_id AUTO_LINK No No required parameter N/A N/A The ID of the topic to which this poll is being added or edited
$poll_id ?AUTO_LINK No No required parameter N/A N/A If editing a poll, the ID of the poll being edited (null: adding a new poll)
$answers array No No required parameter N/A N/A A list of pairs of the potential voteable answers and the number of votes
&$is_private BINARY Yes No required parameter N/A N/A Whether the result tallies are kept private until the poll is made non-private (returned by reference)
&$is_open BINARY Yes No required parameter N/A N/A Whether the poll is open for voting (returned by reference)
&$minimum_selections integer Yes No required parameter N/A N/A The minimum number of selections that may be made (returned by reference)
&$maximum_selections integer Yes No required parameter N/A N/A The maximum number of selections that may be made (returned by reference)
&$requires_reply BINARY Yes No required parameter N/A N/A Whether members must have a post in the topic before they made vote (returned by reference)
&$closing_time ?TIME Yes No required parameter N/A N/A The time at which voting for this poll will close (returned by reference) (null: the poll will not close automatically)
&$view_member_votes BINARY Yes No required parameter N/A N/A Whether others should be allowed to see which members voted for each option on the results (returned by reference)
&$vote_revocation BINARY Yes No required parameter N/A N/A Whether to allow voters to revoke their vote while voting is open
&$guests_can_vote BINARY Yes No required parameter N/A N/A Whether guests can vote on the poll without logging in
&$point_weighting BINARY Yes No required parameter N/A N/A Whether votes will be weighed according to voter points

Preview

Code (PHP)

/**
 * Warn_exit on any invalid poll answers. Also enforces poll options via parameter return by reference where applicable.
 *
 * @param  AUTO_LINK $topic_id The ID of the topic to which this poll is being added or edited
 * @param  ?AUTO_LINK $poll_id If editing a poll, the ID of the poll being edited (null: adding a new poll)
 * @param  array $answers A list of pairs of the potential voteable answers and the number of votes
 * @param  BINARY $is_private Whether the result tallies are kept private until the poll is made non-private (returned by reference)
 * @param  BINARY $is_open Whether the poll is open for voting (returned by reference)
 * @param  integer $minimum_selections The minimum number of selections that may be made (returned by reference)
 * @param  integer $maximum_selections The maximum number of selections that may be made (returned by reference)
 * @param  BINARY $requires_reply Whether members must have a post in the topic before they made vote (returned by reference)
 * @param  ?TIME $closing_time The time at which voting for this poll will close (returned by reference) (null: the poll will not close automatically)
 * @param  BINARY $view_member_votes Whether others should be allowed to see which members voted for each option on the results (returned by reference)
 * @param  BINARY $vote_revocation Whether to allow voters to revoke their vote while voting is open
 * @param  BINARY $guests_can_vote Whether guests can vote on the poll without logging in
 * @param  BINARY $point_weighting Whether votes will be weighed according to voter points
 */

function cns_validate_poll(int $topic_id, ?int $poll_id, array $answers, int &$is_private, int &$is_open, int &$minimum_selections, int &$maximum_selections, int &$requires_reply, ?int &$closing_time, int &$view_member_votes, int &$vote_revocation, int &$guests_can_vote, int &$point_weighting)