You are here

function user_delete_comment_mass_update in User Delete 6.2

Make mass update of comments, changing all comments in the $comments array to update them with the field values in $updates.

IMPORTANT NOTE: This function is intended to work when called from a form submit handler. Calling it outside of the form submission process may not work correctly.

Parameters

array $comments: Array of node cids to update.

array $updates: Array of key/value pairs with comment field names and the value to update that field to.

1 call to user_delete_comment_mass_update()
user_delete_comment_cancel in ./user_delete.module
Mimics hook_user_cancel() for comment module.

File

./user_delete.module, line 900
Provide account cancellation methods and API to provide the same functionalty as Drupal 7 for cancelling accounts.

Code

function user_delete_comment_mass_update($comments, $updates) {

  // We use batch processing to prevent timeout when updating a large number
  // of nodes.
  if (count($comments) > 10) {
    $batch = array(
      'operations' => array(
        array(
          '_user_delete_comment_mass_update_batch_process',
          array(
            $comments,
            $updates,
          ),
        ),
      ),
      'finished' => '_user_delete_comment_mass_update_batch_finished',
      'title' => t('Processing'),
      // We use a single multi-pass operation, so the default
      // 'Remaining x of y operations' message will be confusing here.
      'progress_message' => '',
      'error_message' => t('The update has encountered an error.'),
    );
    batch_set($batch);
  }
  else {
    foreach ($comments as $cid) {
      _user_delete_comment_mass_update_helper($cid, $updates);
    }
    drupal_set_message(t('The comment update process has been performed.'));
  }
}