You are here

function drupagram_account_delete in Drupagram 7

Same name and namespace in other branches
  1. 6 drupagram.inc \drupagram_account_delete()

Delete a drupagram account and its statuses.

Parameters

$drupagram_id: An integer with the Instagram UID.

$username: Optional string with the user name.

1 call to drupagram_account_delete()
drupagram_account_list_form_submit in ./drupagram.pages.inc
@todo Please document this function.

File

./drupagram.inc, line 246
Instagram API functions

Code

function drupagram_account_delete($drupagram_id) {
  $account = drupagram_account_load($drupagram_id);

  // Delete from {drupagram_account}.
  $query = db_delete('drupagram_account');
  $query
    ->condition('drupagram_id', $drupagram_id);
  $query
    ->execute();

  // Delete from {drupagram}.
  $query = db_delete('drupagram');
  $query
    ->condition('username', $account->username);
  $query
    ->execute();

  // Delete from {drupagram_account}.
  $query = db_delete('authmap');
  $query
    ->condition('authname', $drupagram_id);
  $query
    ->condition('module', 'drupagram');
  $query
    ->execute();
  if (module_exists('entitycache')) {
    cache_clear_all($account->uid, 'cache_entity_user');
  }
}