New filter for generate_pdf_ajax
-
Hi,
I am currently developing a WooCommerce multi-store website, and I was hoping to use your plugin to generate the necessary PDFs.
Really like the plugin by the way. Works really well ??
Currently, I am using WC Vendors to accomplish this – but I want to add the “PDF Invoice” button to where the Shop Owner have incoming orders.
I can easily add a button, like you suggest in your FAQ, to the necessary page, but I am blocked by these lines of code in the generate_pdf_ajax function.
includes/class-wcpdf-export.php, line: 446
// Check if current user is owner of order IMPORTANT!!! if ( $this->order->user_id != get_current_user_id() ) { wp_die( __( 'You do not have sufficient permissions to access this page.', 'wpo_wcpdf' ) ); }
This is obviously very important code (don’t want to spill the beans on anyone’s details!)
I kindly ask if you could add a custom filter that I can plug into to allow additional checks?
Any filter name would do, something like this would be perfect:
// Check if current user is owner of order IMPORTANT!!! if ( apply_filters('wpo_wcpdf_check_owner_priv', $this->order->user_id != get_current_user_id() ) ) { wp_die( __( 'You do not have sufficient permissions to access this page.', 'wpo_wcpdf' ) ); }
That way, I can check if the order belongs to the vendor so they can also download the generated invoice for packing purposes.
I hope you can implement this – I’m sure there are other developers would also want to use this.
Cheers ??
- The topic ‘New filter for generate_pdf_ajax’ is closed to new replies.