Function __global->cns_make_poll
Definitions
sources/cns_polls_action.php
- Add a forum poll.
- Visibility: public
- Is abstract?: No
- Is static?: No
- Is final?: No
- Returns: int
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 add the poll to |
| $question | SHORT_TEXT | No | No | required parameter | N/A | N/A | The question |
| $is_private | BINARY | No | No | required parameter | N/A | N/A | Whether the result tallies are kept private until the poll is made non-private |
| $is_open | BINARY | No | No | required parameter | N/A | N/A | Whether the poll is open for voting |
| $minimum_selections | integer | No | No | required parameter | N/A | N/A | The minimum number of selections that may be made |
| $maximum_selections | integer | No | No | required parameter | N/A | N/A | The maximum number of selections that may be made |
| $requires_reply | BINARY | No | No | required parameter | N/A | N/A | Whether members must have a post in the topic before they made vote |
| $answers | array | No | No | required parameter | N/A | N/A | A list of the potential voteable answers |
| $view_member_votes | BINARY | No | No | required parameter | N/A | N/A | Whether others should be able to view individual members' votes in the results |
| $vote_revocation | BINARY | No | No | required parameter | N/A | N/A | Whether to allow voters to revoke their vote when the poll's voting is still open |
| $guests_can_vote | BINARY | No | No | required parameter | N/A | N/A | Whether guests can vote on the poll without logging in |
| $point_weighting | BINARY | No | No | required parameter | N/A | N/A | Whether results for this poll should be weighed based on voter's points |
| $check_permissions | boolean | No | No | True | N/A | N/A | Whether to check there are permissions to make the poll |
| $poll_closing_time | ?TIME | No | No | Null | N/A | N/A | The time voting should close on this poll (null: the poll will not close automatically) |
Returns
- The ID of the newly created forum poll
- Type: AUTO_LINK
- Set: N/A
- Range: N/A
Preview
Code (PHP)
/**
* Add a forum poll.
*
* @param AUTO_LINK $topic_id The ID of the topic to add the poll to
* @param SHORT_TEXT $question The question
* @param BINARY $is_private Whether the result tallies are kept private until the poll is made non-private
* @param BINARY $is_open Whether the poll is open for voting
* @param integer $minimum_selections The minimum number of selections that may be made
* @param integer $maximum_selections The maximum number of selections that may be made
* @param BINARY $requires_reply Whether members must have a post in the topic before they made vote
* @param array $answers A list of the potential voteable answers
* @param BINARY $view_member_votes Whether others should be able to view individual members' votes in the results
* @param BINARY $vote_revocation Whether to allow voters to revoke their vote when the poll's voting is still open
* @param BINARY $guests_can_vote Whether guests can vote on the poll without logging in
* @param BINARY $point_weighting Whether results for this poll should be weighed based on voter's points
* @param boolean $check_permissions Whether to check there are permissions to make the poll
* @param ?TIME $poll_closing_time The time voting should close on this poll (null: the poll will not close automatically)
* @return AUTO_LINK The ID of the newly created forum poll
*/
function cns_make_poll(int $topic_id, string $question, int $is_private, int $is_open, int $minimum_selections, int $maximum_selections, int $requires_reply, array $answers, int $view_member_votes, int $vote_revocation, int $guests_can_vote, int $point_weighting, bool $check_permissions = true, ?int $poll_closing_time = null) : int
* Add a forum poll.
*
* @param AUTO_LINK $topic_id The ID of the topic to add the poll to
* @param SHORT_TEXT $question The question
* @param BINARY $is_private Whether the result tallies are kept private until the poll is made non-private
* @param BINARY $is_open Whether the poll is open for voting
* @param integer $minimum_selections The minimum number of selections that may be made
* @param integer $maximum_selections The maximum number of selections that may be made
* @param BINARY $requires_reply Whether members must have a post in the topic before they made vote
* @param array $answers A list of the potential voteable answers
* @param BINARY $view_member_votes Whether others should be able to view individual members' votes in the results
* @param BINARY $vote_revocation Whether to allow voters to revoke their vote when the poll's voting is still open
* @param BINARY $guests_can_vote Whether guests can vote on the poll without logging in
* @param BINARY $point_weighting Whether results for this poll should be weighed based on voter's points
* @param boolean $check_permissions Whether to check there are permissions to make the poll
* @param ?TIME $poll_closing_time The time voting should close on this poll (null: the poll will not close automatically)
* @return AUTO_LINK The ID of the newly created forum poll
*/
function cns_make_poll(int $topic_id, string $question, int $is_private, int $is_open, int $minimum_selections, int $maximum_selections, int $requires_reply, array $answers, int $view_member_votes, int $vote_revocation, int $guests_can_vote, int $point_weighting, bool $check_permissions = true, ?int $poll_closing_time = null) : int
