Introduction   Getting Started   Upgrading   Function Reference   Changelog   Support and Feedback

new_poll

Usage: bool new_poll (int topicid, string question, array choices)
Purpose: Returns the topic id of a poll.
Availability: IPB SDK 1.0

Creates a new poll in topic topicid, with the question question and choices choices.

Returns TRUE on success. If the poll could not be created, FALSE will be returned, a fuller error message can be retrieved using sdk_error.

/*
create a new poll in topic 666
question: Does Weebl and Bob own?
answers: Yes, No
*/

$options = array("Yes", "No");
$SDK->new_poll ("666", "Does Weebl and Bob Own?", $options);


User Contributed Notes

cow
I've had several questions/misconceptions about the new_poll function. Some users think of the new_poll function as something similar to IPB's New Poll button, this is not the case. You can think of the new_poll function as an equivilent to IPB's "Attach Poll to Topic" feature. When you pass a topic id to this function, it should already exists. If you wish to emulate the "New Poll" feature of IPB, you should firstly create a new topic using new_topic, before using new_poll.

ipcn
$topicid = $SDK->new_topic('4', 'New Topic', 'New Topic with Poll', 'Test for Poll');
$SDK->new_poll($topicid, 'Testing new Poll', array('Test','Test 2','Test3'));

The above will create a new topic and attach a new poll to it. A nice easy way to do it smile.gif

Documentation Generated at Sat, 16 Apr 2005 07:36:35 -0700
Find the latest version at http://ipbsdk.sourceforge.net