_rsvp_mail_rsvp

Definition

_rsvp_mail_rsvp($rid, $from = NULL, $resend = FALSE)
rsvp/rsvp.module, line 1664

Description

  • Emails the invite to the attendees of an rsvp instance.
*
  • *

Parameters

$rid The rid of the rsvp.

  • @param $resend True: sends only to recipients with received flag not set. default: false.
  • @return array of status values.

Related topics

Namesort iconDescription
functions for rsvp mailing.

Code

<?php
function _rsvp_mail_rsvp($rid, $from = NULL, $resend = FALSE) {
  $status['success'] = array();
  $status['failed'] = array();
  $attendees = _rsvp_get_attendees($rid);
  while ($attendee = db_fetch_object($attendees)) {
    if (!($resend && $attendee->received) && !($attendee->invited)) {
      $invite = _rsvp_get_invite($attendee->hash);
      if (rsvp_send_invitation($invite, $from)) {
        db_query('UPDATE {rsvp_invite} SET invited = 1 WHERE hash = \'%s\'', $attendee->hash);
        // hide e-mails for system users
        $user = user_load(array('uid' => $attendee->uid));
        $status['success'][] = ($user->uid == 0 ? $invite->email : $user->name);
      }
      else {
        // hide e-mails for system users
        $user = user_load(array('uid' => $attendee->uid));
        $status['failed'][] = ($user->uid == 0 ? $invite->email : $user->name);
      }
    }
  }
  return $status;
}
?>