You are here

function invite_delete in Invite 5.2

Same name and namespace in other branches
  1. 5 invite.module \invite_delete()
  2. 6.2 invite.module \invite_delete()
  3. 7.4 invite.module \invite_delete()
  4. 7.2 invite.module \invite_delete()

Physically delete all invites from and to a user.

Parameters

$uid: The user id to delete invites for.

1 call to invite_delete()
invite_user in ./invite.module
Implementation of hook_user().

File

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

Code

function invite_delete($uid) {

  // Delete invite for this user if the originating user has the permission.
  $origin = db_result(db_query("SELECT uid FROM {invite} WHERE invitee = %d", $uid));
  if ($origin && ($inviter = user_load(array(
    'uid' => $origin,
  )))) {
    if (user_access('withdraw accepted invitations', $inviter)) {
      db_query("DELETE FROM {invite} WHERE invitee = %d", $uid);
    }
  }

  // Delete any invites originating from this user.
  db_query("DELETE FROM {invite} WHERE uid = %d", $uid);

  // Clean up the notification queue.
  db_query("DELETE FROM {invite_notifications} WHERE uid = %d OR invitee = %d", $uid, $uid);
}