You are here

function _invite_check_messages in Invite 5

Displays a notification message when an invited user has registered.

Parameters

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

1 call to _invite_check_messages()
invite_menu in ./invite.module
Implementation of hook_menu().

File

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

Code

function _invite_check_messages($uid) {
  $result = db_query('SELECT i.mid, i.email FROM {invite} i INNER JOIN {users} u ON u.uid = i.mid AND u.status = 1 WHERE i.uid = %d AND i.timestamp != 0 AND i.received = 0', $uid);
  while ($invite = db_fetch_object($result)) {
    $account = user_load(array(
      'uid' => $invite->mid,
    ));
    drupal_set_message(t('!user (@email) has joined @site-name!', array(
      '!user' => theme('username', $account),
      '@email' => $invite->email,
      '@site-name' => variable_get('site_name', t('Drupal')),
    )));
    db_query("UPDATE {invite} SET received = 1 WHERE email = '%s'", $invite->email);
  }
}