You are here

function node_limit_user_delete in Node Limit 8

Same name and namespace in other branches
  1. 7 node_limit_user/node_limit_user.module \node_limit_user_delete()

Implements hook_user_delete().

Delete all limit rules related to the deleted user.

File

old/node_limit_user/node_limit_user.module, line 13
Module to restrict the number of nodes by user.

Code

function node_limit_user_delete($account) {
  $limits = \Drupal::database()
    ->select('node_limit_user', 'src')
    ->fields('src', array(
    'lid',
  ))
    ->condition('uid', $account->uid)
    ->execute();
  $lids = array();
  foreach ($limits as $limit) {
    $lids[] = $limit->lid;
  }
  node_limit_delete($lids);
}