/** * Delete associated sub imports * @return PMXI_Import_Record * @chainable */ public function deleteChildren($keepPosts = TRUE) { $importList = new PMXI_Import_List(); foreach ($importList->getBy('parent_import_id', $this->id)->convertRecords() as $i) { $i->delete($keepPosts); } return $this; }
/** * Bulk actions */ public function bulk() { check_admin_referer('bulk-imports', '_wpnonce_bulk-imports'); if ($this->input->post('doaction2')) { $this->data['action'] = $action = $this->input->post('bulk-action2'); } else { $this->data['action'] = $action = $this->input->post('bulk-action'); } $this->data['ids'] = $ids = $this->input->post('items'); $this->data['items'] = $items = new PMXI_Import_List(); if (empty($action) or !in_array($action, array('delete')) or empty($ids) or $items->getBy('id', $ids)->isEmpty()) { wp_redirect($this->baseUrl); die; } if ($this->input->post('is_confirmed')) { $is_delete_posts = $this->input->post('is_delete_posts'); foreach ($items->convertRecords() as $item) { $item->delete(!$is_delete_posts); } wp_redirect(add_query_arg('pmxi_nt', urlencode(sprintf(__('<strong>%d</strong> %s deleted', 'wp_all_import_plugin'), $items->count(), _n('import', 'imports', $items->count(), 'wp_all_import_plugin'))), $this->baseUrl)); die; } $this->render(); }