You are here

function invite_notify in Invite 6.2

Same name and namespace in other branches
  1. 5.2 invite.module \invite_notify()
  2. 7.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 309
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 = %d', $uid);
  while ($row = db_fetch_object($result)) {
    $account = user_load(array(
      'uid' => $row->invitee,
      'status' => 1,
    ));
    if ($account) {
      drupal_set_message(t('!user (@email) has joined @site-name!', array(
        '!user' => theme('username', $account),
        '@email' => $account->mail,
        '@site-name' => variable_get('site_name', t('Drupal')),
      )));
      db_query("DELETE FROM {invite_notifications} WHERE uid = %d AND invitee = %d", $uid, $row->invitee);
    }
  }
}