You are here

function oauth_common_user in OAuth 1.0 6.3

Implementation of hook_user().

File

./oauth_common.module, line 232

Code

function oauth_common_user($op, &$edit, &$account, $category = NULL) {
  if ($op == 'delete') {

    // Delete all tokens and consumers related to a user
    module_load_include('inc', 'oauth_common');
    db_query("DELETE c, pc, t, pt FROM {oauth_common_consumer} c\n      INNER JOIN {oauth_common_provider_consumer} pc ON pc.csid = c.csid\n      LEFT JOIN {oauth_common_token} t ON t.csid = c.csid\n      LEFT JOIN {oauth_common_provider_token} pt ON pt.tid = t.tid\n      WHERE pc.uid = %d", array(
      ':uid' => $account->uid,
    ));
    db_query("DELETE t, pt FROM {oauth_common_token} t\n      LEFT JOIN {oauth_common_provider_token} pt ON pt.tid = t.tid\n      WHERE uid = %d", array(
      ':uid' => $account->uid,
    ));
  }
}