You are here

function privatemsg_devel_generate_form_validate in Privatemsg 7.2

Same name and namespace in other branches
  1. 6.2 privatemsg.devel_generate.inc \privatemsg_devel_generate_form_validate()

Validate; Integrates with Devel Generate.

See also

privatemsg_devel_generate_form()

privatemsg_devel_generate_form_submit()

File

./privatemsg.devel_generate.inc, line 109

Code

function privatemsg_devel_generate_form_validate($form_id, &$form_state) {
  module_load_include('inc', 'devel_generate');
  $uids = devel_get_users();
  $max_recipients = $form_state['values']['max_recipients'];

  // Ensure that there are enough users to fit the max recipients.
  // Note, messages cannot be sent from anonymous users, so exclude them.
  if (count($uids) - 1 < $max_recipients) {
    form_set_error('recipients][max_recipients', t('You only have @count_uids users to handle @count_recipients recipients. You must increase the number of users.', array(
      '@count_uids' => count($uids) - 1,
      '@count_recipients' => $max_recipients,
    )));
  }
}