You are here

function invite_notify in Invite 7.2

Same name and namespace in other branches
  1. 5.2 invite.module \invite_notify()
  2. 6.2 invite.module \invite_notify()

Displays a notification message when an invited user has registered.

Parameters

$uid: The user id to check accepted invitations for.

1 call to invite_notify()
invite_init in ./invite.module
Implements hook_init().

File

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

Code

function invite_notify($uid) {
  $result = db_query('SELECT invitee FROM {invite_notifications} WHERE uid = :uid', array(
    ':uid' => $uid,
  ))
    ->fetchAll();
  foreach ($result as $row) {
    $account = user_load_multiple(array(
      $row->invitee,
    ), array(
      'status' => 1,
    ));
    if (!empty($account[$row->invitee])) {
      drupal_set_message(t('!user (@email) has joined @site-name!', array(
        '!user' => theme('username', array(
          'account' => $account[$row->invitee],
        )),
        '@email' => $account[$row->invitee]->mail,
        '@site-name' => variable_get('site_name', t('Drupal')),
      )));
      db_query("DELETE FROM {invite_notifications} WHERE uid = :uid AND invitee = :invitee", array(
        ':uid' => $uid,
        ':invitee' => $row->invitee,
      ));
    }
  }
}