You are here

function regcode_mailer_mail_action_validate in Registration codes 7

Same name and namespace in other branches
  1. 6.2 regcode_mailer/regcode_mailer.module \regcode_mailer_mail_action_validate()
  2. 7.2 regcode_mailer/regcode_mailer.module \regcode_mailer_mail_action_validate()

Validate action for the form.

We need to ensure that they have actually used [regcode] somewhere.

File

regcode_mailer/regcode_mailer.module, line 80
Main code functionality and hooks of regcode_mailer module.

Code

function regcode_mailer_mail_action_validate($form, $form_state) {
  $message = $form_state['values']['regcode_mailer_message'];
  if (strpos($message, '[regcode:code]') === FALSE && strpos($message, '[regcode:regurl]') === FALSE) {
    form_set_error('regcode_mailer_message', t('Cannot send message without registration code - you should insert either [regcode:code] or [regcode:regurl] token in the message body.'));
  }
}