function comment_user_predelete

comment_user_predelete($account)

Implements hook_ENTITY_TYPE_predelete() for user entities.

File

core/modules/comment/comment.module, line 542
Enables users to comment on published content.

Code

function comment_user_predelete($account) {
  $entity_query = \Drupal::entityQuery('comment');
  $entity_query->condition('uid', $account->id());
  $cids = $entity_query->execute();
  entity_delete_multiple('comment', $cids);
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!comment!comment.module/function/comment_user_predelete/8.1.x