You are here

function user_relationship_invites_user in User Relationships 5

Same name and namespace in other branches
  1. 5.2 plugins/user_relationship_invites/user_relationship_invites.module \user_relationship_invites_user()
  2. 6 user_relationship_invites/user_relationship_invites.module \user_relationship_invites_user()

Implements hook_user()

File

plugins/user_relationship_invites/user_relationship_invites.module, line 110
Drupal Module: User Relationship Invites

Code

function user_relationship_invites_user($type, &$edit, &$account, $category = NULL) {
  if (!(module_exists('invite') && module_exists('user_relationships'))) {
    return;
  }
  switch ($type) {
    case 'insert':
      if (isset($edit['relationship_invite_approve'])) {
        db_query("DELETE FROM {user_relationship_invites} WHERE invite_code = '%s'", $edit['invite_code']);
        if ($edit['relationship_invite_approve'] == 'approve') {
          user_relationships_request_relationship($edit['relationship_invite_requester'], $account, $edit['relationship_type'], TRUE);
        }
      }
      break;
  }
}