You are here

function _invite_validate_emails in Invite 6.2

Same name and namespace in other branches
  1. 5.2 invite.module \_invite_validate_emails()
  2. 5 invite.module \_invite_validate_emails()
  3. 7.2 invite.module \_invite_validate_emails()

Filter out e-mails based on a database query.

Parameters

$sql: The query to execute.

&$emails: The list of e-mail addresses to validate. When this function returns, all invalid e-mails have already been removed.

...: More query arguments.

Return value

An array of invalid e-mail addresses.

1 call to _invite_validate_emails()
invite_form_validate in ./invite.module
Forms API callback; validate submitted form data.

File

./invite.module, line 1054
Allows your users to send and track invitations to join your site.

Code

function _invite_validate_emails($sql, &$emails) {
  $failed_emails = array();

  // Build query arguments.
  $args = func_get_args();
  $args = array_merge($emails, array_slice($args, 2));
  $result = db_query($sql, $args);
  while ($row = db_fetch_object($result)) {
    $failed_emails[] = $row->email;
  }

  // Keep only valid e-mails.
  $emails = array_diff($emails, $failed_emails);
  return $failed_emails;
}