You are here

function webform_submission_resend_submit in Webform 7.4

Same name and namespace in other branches
  1. 6.3 includes/webform.submissions.inc \webform_submission_resend_submit()
  2. 7.3 includes/webform.submissions.inc \webform_submission_resend_submit()

Submit handler for webform_submission_resend().

File

includes/webform.submissions.inc, line 613
Submission handling functions.

Code

function webform_submission_resend_submit($form, &$form_state) {
  $node = $form['#node'];
  $submission = $form['#submission'];
  $emails = array();
  foreach ($form_state['values']['resend'] as $eid => $checked) {
    if ($checked) {
      $emails[] = $form['#node']->webform['emails'][$eid];
    }
  }
  $sent_count = webform_submission_send_mail($node, $submission, $emails, TRUE);
  if ($sent_count) {
    drupal_set_message(format_plural($sent_count, 'Successfully re-sent submission #@sid to 1 recipient.', 'Successfully re-sent submission #@sid to @count recipients.', array(
      '@sid' => $submission->sid,
    )));
  }
  else {
    drupal_set_message(t('No e-mails were able to be sent due to a server error.'), 'error');
  }
}