The Arcive of vBulletin Modifications Site. |
|
|
#1
|
|||
|
|||
|
Hi,
I am trying to use DataManager to vote on a specific poll using the following code. I am aware that the datamanager pollvote will use 'REPLACE INTO', so even if they already voted, it will still update it with the vote specified. Code:
require_once('./global.php');
require_once('./includes/functions_databuild.php');
require_once('./includes/class_dm_pollvote.php');
require_once('./includes/class_dm_poll.php');
global $vbulletin;
$pollvote =& datamanager_init('PollVote', $vbulletin, ERRTYPE_STANDARD);
$pollvote->set('pollid', 125);
$pollvote->set('votedate', TIMENOW);
$pollvote->set('voteoption', 1);
$pollvote->set('userid', 1);
$pollvote->set('votetype', 0);
$pollvote->pre_save;
if(!count($pollvote->errors) < 1)
{
echo "An error occured when voting:". $pollvote->errors[0] . $pollvote->errors[1] . $pollvote->errors[2] ;
}
else
{
$pollvoteid = $pollvote->save;
}
Edit: Fixed by adding $pollvote->save(); <-- brackets |
| Благодарность от: | ||
| tbworld | ||
![]() |
|
|
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
|
|
More Information |
|
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|