0

Here is my source:

function sc_delete_user_confirm_form_submit($form, &$form_state) {
   //...
      $batch = array(
        'operations' => array(),
        'finished' => 'user_delete_tickets_batch_finished',
        'title' => t('Processing delete user tickets'),
        'init_message' => t('Deleting user tickets is starting.'),
        'progress_message' => t('Processing...'),
        'error_message' => t('Deleting user tickets has encountered an error.'),
      );
      $batch['operations'][] = array('user_delete_tickets_batch_process', array());
      batch_set($batch);
  //...
}

function user_delete_tickets_batch_process(&$context) {
  watchdog('my_module', 'user_delete_tickets_batch_process ENTER!', array(),  WATCHDOG_ERROR);
  //...
}

function user_delete_tickets_batch_finished($success, $results, $operations) {
  watchdog(my_module', 'user_delete_tickets_batch_finished ENTER!', array(), WATCHDOG_ERROR);
  //...
}

I see progress bar but it not call my callback method user_delete_tickets_batch_process (I didn't see log in /admin/reports/dblog), also it not call user_delete_tickets_batch_finished. What is wrong in this my source.

1 Answer 1

1

Try specifing the file where your functions are located.

Even if those functions are in the same file as your #submit callback, the file path may be needed.

$batch = array(
  'operations' => array(),
  'finished' => 'user_delete_tickets_batch_finished',
  'title' => t('Processing delete user tickets'),
  'init_message' => t('Deleting user tickets is starting.'),
  'progress_message' => t('Processing...'),
  'error_message' => t('Deleting user tickets has encountered an error.'),
  'file' => drupal_get_path('module', 'your_module') . '/your_module.module'
);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.