Hi, I created some code:
PHP Code:
//First, get the pollid
$clubpollid = $vbulletin->db->query_first("SELECT pollid FROM " . TABLE_PREFIX . "thread WHERE threadid = $pollthread");
//Now we get the voters
$votersids = array();
while ($onepollid = $vbulletin->db->fetch_array($clubpollid))
{
$votersids[] = $vbulletin->db->query_read("SELECT userid FROM " . TABLE_PREFIX . "pollvote WHERE pollid = $onepollid ORDER BY userid ASC");
}
$db->free_result($votersids);
//Now, we get the senders
$clubpollvoter = array();
while ($voterid = $vbulletin->db->fetch_array($votersid))
{
$clubpollvoter[] = $vbulletin->db->query_read(" SELECT username FROM " . TABLE_PREFIX . "user WHERE userid = $voterid ORDER BY username ASC");
}
$db->free_result($clubpollvoter);
$pmto_users = array();
while ($name = $db->fetch_array($clubpollvoter))
{
$pmto_users[] = $name['username'];
}
$db->free_result($pmto_users);
$pmtousernames = implode(';', $pmto_users);
$db->free_result($pmtousernames);
$pollthread is a hand inputed threadid. $pmtousernames is then passed on to the PM Data Manager. However, I can never get past this point. Is there something wrong in my code?
Thanks for your help!