You are here

function heartbeat_user_delete in Heartbeat 7

Implements hook_user_delete().

File

./heartbeat.module, line 260
Module file for heartbeat activity. Basic hook implementations and helper functions will be found here.

Code

function heartbeat_user_delete($account) {

  // Delete messages from removed users.
  $query = db_select('heartbeat_activity', 'ha');
  $query
    ->addField('ha', 'uaid');
  $query
    ->condition(db_or()
    ->condition('uid', $account->uid)
    ->condition('uid_target', $account->uid));
  foreach ($query
    ->execute() as $row_object) {
    $uaids[] = $row_object->uaid;
  }
  if (!empty($uaids)) {
    heartbeat_activity_delete($uaids);
  }
}