function user_delete_comment_cancel in User Delete 6.2
Mimics hook_user_cancel() for comment module.
1 call to user_delete_comment_cancel()
- user_delete_user_cancel in ./
user_delete.module - Implements hook_user_cancel();
File
- ./
user_delete.module, line 849 - Provide account cancellation methods and API to provide the same functionalty as Drupal 7 for cancelling accounts.
Code
function user_delete_comment_cancel($edit, $account, $method) {
switch ($method) {
case 'user_cancel_block_unpublish':
// Unpublish comments.
$result = db_query("SELECT cid FROM {comments} WHERE uid = %d", $account->uid);
$cids = array();
while ($cid = db_result($result)) {
$cids[] = $cid;
}
// Set status to 1 put into moderation queue.
// @TODO: Also remove email and username..
user_delete_comment_mass_update($cids, array(
'status' => 1,
));
break;
case 'user_cancel_reassign':
// Anonymize comments.
$result = db_query("SELECT cid FROM {comments} WHERE uid = %d", $account->uid);
$cids = array();
while ($cid = db_result($result)) {
$cids[] = $cid;
}
user_delete_comment_mass_update($cids, array(
'uid' => 0,
));
break;
case 'user_cancel_delete':
// delete comments.
$result = db_query("SELECT cid FROM {comments} WHERE uid = %d", $account->uid);
$cids = array();
while ($cid = db_result($result)) {
$cids[] = $cid;
}
user_delete_comment_mass_delete($cids);
}
}