| @@ -57,11 +57,11 @@ | ||
| 57 | 57 | public function bulk_action() { |
| 58 | 58 | |
| 59 | 59 | if ($this->get->get('uid')) { |
| 60 | 60 | $model_e2pdf_bulk = new Model_E2pdf_Bulk(); |
| 61 | - if ($model_e2pdf_bulk->load_by_uid($this->get->get('uid')) && file_exists($this->helper->get('bulk_dir') . $model_e2pdf_bulk->get('uid') . '.zip')) { | |
| 61 | + if ($model_e2pdf_bulk->load_by_uid($this->get->get('uid')) && file_exists($this->helper->get('bulk_dir') . $model_e2pdf_bulk->get('uid') . '.zip') && $model_e2pdf_bulk->load($model_e2pdf_bulk->get('ID'))) { | |
| 62 | 62 | $this->helper->set_time_limit(0); |
| 63 | - $this->download_response('zip', $this->helper->get('bulk_dir') . $model_e2pdf_bulk->get('uid') . '.zip', $model_e2pdf_bulk->get('uid'), '', true); | |
| 63 | + $this->download_response('zip', $this->helper->get('bulk_dir') . $model_e2pdf_bulk->get('uid') . '.zip', $model_e2pdf_bulk->get('ID') . ' - ' . $model_e2pdf_bulk->get('template')->get('title'), '', true); | |
| 64 | 64 | exit; |
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | |
| @@ -76,18 +76,18 @@ | ||
| 76 | 76 | $this->add_notification('notice', sprintf(__("Bulk PDF generation is not available with the Free License Type. Please visit <a target='_blank' href='%s'>%s</a> for upgrade options", 'e2pdf'), 'https://e2pdf.com/price', 'https://e2pdf.com')); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | $users_tmp = get_users( |
| 80 | - array( | |
| 81 | - 'fields' => array( | |
| 80 | + [ | |
| 81 | + 'fields' => [ | |
| 82 | 82 | 'ID', 'user_login', |
| 83 | - ), | |
| 84 | - ) | |
| 83 | + ], | |
| 84 | + ] | |
| 85 | 85 | ); |
| 86 | 86 | |
| 87 | - $users = array( | |
| 87 | + $users = [ | |
| 88 | 88 | '0' => __('--- Select ---', 'e2pdf'), |
| 89 | - ); | |
| 89 | + ]; | |
| 90 | 90 | foreach ($users_tmp as $user) { |
| 91 | 91 | $users[$user->ID] = $user->user_login; |
| 92 | 92 | } |
| 93 | 93 | |
| @@ -157,9 +157,8 @@ | ||
| 157 | 157 | $template = new Model_E2pdf_Template(); |
| 158 | 158 | if ($template->load($template_id)) { |
| 159 | 159 | |
| 160 | 160 | $entry = new Model_E2pdf_Entry(); |
| 161 | - | |
| 162 | 161 | $entry->set_data('template_id', $template_id); |
| 163 | 162 | $template->extension()->set('template_id', $template_id); |
| 164 | 163 | |
| 165 | 164 | if ($dataset) { |
| @@ -205,9 +204,9 @@ | ||
| 205 | 204 | $template->extension()->set('storing_engine', $template->extension()->get_storing_engine()); |
| 206 | 205 | } |
| 207 | 206 | |
| 208 | 207 | if ($template->extension()->verify()) { |
| 209 | - | |
| 208 | + add_filter('acf/shortcode/prevent_access_to_fields_on_non_public_posts', [$this->helper, '__return_false'], 999); | |
| 210 | 209 | if (array_key_exists('inline', $atts)) { |
| 211 | 210 | $inline = $atts['inline']; |
| 212 | 211 | if ($template->get('inline') !== $inline) { |
| 213 | 212 | $entry->set_data('inline', $inline); |
| @@ -339,8 +338,9 @@ | ||
| 339 | 338 | do_action('e2pdf_controller_e2pdf_export_completed', $request['file'], $template); |
| 340 | 339 | $this->download_response($template->get('format'), $request['file'], $template->get_name(), $disposition, false, true); |
| 341 | 340 | exit; |
| 342 | 341 | } |
| 342 | + remove_filter('acf/shortcode/prevent_access_to_fields_on_non_public_posts', [$this->helper, '__return_false'], 999); | |
| 343 | 343 | } else { |
| 344 | 344 | $this->add_notification('error', __('Incorrect Dataset', 'e2pdf')); |
| 345 | 345 | $this->render('blocks', 'notifications'); |
| 346 | 346 | } |
| @@ -727,9 +727,9 @@ | ||
| 727 | 727 | } |
| 728 | 728 | |
| 729 | 729 | public function ajax_bulk_create() { |
| 730 | 730 | if (wp_verify_nonce($this->get->get('_wpnonce'), 'e2pdf')) { |
| 731 | - $this->helper->set('license', new Model_E2pdf_License()); | |
| 731 | + $this->helper->load('license')->load(); | |
| 732 | 732 | if ($this->helper->get('license')->get('type') === false) { |
| 733 | 733 | $response = array( |
| 734 | 734 | 'error' => __('Something went wrong!', 'e2pdf'), |
| 735 | 735 | ); |
| @@ -772,14 +772,14 @@ | ||
| 772 | 772 | 'redirect' => $this->helper->get_url( |
| 773 | 773 | array( |
| 774 | 774 | 'page' => 'e2pdf', |
| 775 | 775 | 'action' => 'bulk', |
| 776 | + 'notification' => $this->add_notification('update', __('The Bulk PDFs generation Task is created successfully', 'e2pdf')), | |
| 776 | 777 | ) |
| 777 | 778 | ), |
| 778 | 779 | ); |
| 779 | 780 | } |
| 780 | 781 | $this->cron_bulk_export(); |
| 781 | - $this->add_notification('update', 'The Bulk PDFs generation Task is created successfully', 'e2pdf'); | |
| 782 | 782 | } |
| 783 | 783 | } |
| 784 | 784 | } else { |
| 785 | 785 | $response['error'] = $this->message('wp_verify_nonce_error'); |
| @@ -895,9 +895,11 @@ | ||
| 895 | 895 | $atts[$key] = $value; |
| 896 | 896 | } |
| 897 | 897 | } |
| 898 | 898 | } |
| 899 | + add_filter('acf/shortcode/prevent_access_to_fields_on_non_public_posts', [$this->helper, '__return_false'], 999); | |
| 899 | 900 | $model_e2pdf_shortcode->e2pdf_save($atts); |
| 901 | + remove_filter('acf/shortcode/prevent_access_to_fields_on_non_public_posts', [$this->helper, '__return_false'], 999); | |
| 900 | 902 | } |
| 901 | 903 | } |
| 902 | 904 | } |
| 903 | 905 | if (!wp_next_scheduled('e2pdf_bulk_export_cron')) { |