You are here

function advpoll_convert_form_submit in Advanced Poll 6.2

Same name and namespace in other branches
  1. 5 advpoll_convert.module \advpoll_convert_form_submit()
  2. 6.3 advpoll_convert.module \advpoll_convert_form_submit()
  3. 6 advpoll_convert.module \advpoll_convert_form_submit()

File

./advpoll_convert.module, line 56
Converts a site's standard Drupal polls into Advanced Poll polls.

Code

function advpoll_convert_form_submit($form, &$form_state) {
  $count = 0;
  $result = db_query("SELECT n.nid, n.created, p.runtime, p.active FROM {node} n JOIN {poll} p ON n.nid = p.nid WHERE type = 'poll'");
  while ($poll = db_fetch_object($result)) {
    _advpoll_convert_node($poll);
    $count++;
  }
  drupal_set_message(format_plural($count, '1 poll successfully converted.', '@count polls successfully converted.'));
}