/** * Display download link on My Account page */ public function add_my_account_download_pdf_action($actions, $order) { $invoice = new BEWPI_Invoice($order->id); if ($invoice->exists() && $invoice->is_download_allowed($order->post_status)) { $url = admin_url('admin-ajax.php?action=bewpi_download_invoice&order_id=' . $order->id . '&nonce=' . wp_create_nonce('bewpi_download_invoice')); $actions['invoice'] = array('url' => $url, 'name' => sprintf(__('Invoice %s (PDF)', 'be-woocommerce-pdf-invoices'), $invoice->get_formatted_number())); } return $actions; }
/** * Display download link on My Account page */ public function add_my_account_download_pdf_action($actions, $order) { $general_options = get_option('bewpi_general_settings'); if (!(bool) $general_options['bewpi_download_invoice_account']) { return $actions; } $invoice = new BEWPI_Invoice($order->id); if (!$invoice->exists()) { return $actions; } if (!$invoice->is_download_allowed($order->post_status)) { return $actions; } $url = admin_url('admin-ajax.php?bewpi_action=view&post=' . $order->id . '&nonce=' . wp_create_nonce('view')); $actions['invoice'] = array('url' => $url, 'name' => sprintf(__('Invoice %s (PDF)', 'woocommerce-pdf-invoices'), $invoice->get_formatted_number())); return $actions; }