Save button in backend post edit page

WordPress
April 20, 2021 08:19:38
eliodata
Topics: 19
Messages: 57
Hi there,
Last time you helped we create a metabox displaying my template into the admin post editor:

https://e2pdf.com/support/desk/download-button-in-backend-post-edit-page

Thank you again for the great support!
Is it possible to add a save button shortcode under the pdf view shortcode please? We would like to store some results on the server.

Best regards
April 20, 2021 13:33:24
E2Pdf
Topics: 7
Messages: 3617
Support
Hi,

Here is simplified modified previous code solution: https://codeshare.io/aYpWwY.

In general it must be added custom ajax function which must be called via javascript, which will call [e2pdf-save] shortcode.

Note please: Current code must work however to be correctly: JS code must be added to .js file which must be included via WordPress hooks + it's recommended to add "nonce" security check. Unfortunately to build it correctly we can offer you only paid support.

The file will be saved to default folder if "dir" attribute will not be set with "post_id" name according documentation: [e2pdf-save]

We remain at your service.

We would really appreciate your feedback at WordPress.org!
April 20, 2021 14:42:57
eliodata
Topics: 19
Messages: 57
Your code works great, thank you.
One thing, when I download the pdf the name is ok (I use shortcodes in template name). But when I save the pdf the name is the post ID.
Any idea please?
April 20, 2021 15:04:15
E2Pdf
Topics: 7
Messages: 3617
Support
Modify:

do_shortcode('[e2pdf-save id="1" dataset="' . $dataset . '" name="' . $dataset . '" apply="true"]');

To:

do_shortcode('[e2pdf-save id="1" dataset="' . $dataset . '" apply="true"]');

It must use PDF Name from E2Pdf Template if no name set. Keep in mind that by default PDF will be overwritten if same name.

We remain at your service.

We would really appreciate your feedback at WordPress.org!
April 20, 2021 16:55:45
eliodata
Topics: 19
Messages: 57
Damned, perfect :)
May I ask you it is possible to generate folder name dynamically, like post title, post ID or any custom field ?
Many thanks again and again...
April 20, 2021 17:40:48
E2Pdf
Topics: 7
Messages: 3617
Support
E2Pdf can create dynamic dirs, it must be used "dir" with "create_dir" attribute.

https://e2pdf.com/support/docs#shortcode-e2pdf-save

as follows:

do_shortcode('[e2pdf-save id="1" dataset="' . $dataset . '" dir="wp-content/uploads/dir/" create_dir="true" apply="true"]');

You must be able still use shortcodes inside "dir" attribute or create it dynamic via PHP with needed values as:

$post = get_post($dataset);
if ($post) {
$dir = 'wp-content/uploads/dir/' . $post->ID;
do_shortcode('[e2pdf-save id="1" dataset="' . $dataset . '" dir="'.$dir.'" create_dir="true" apply="true"]');
}

We remain at your service.

We would really appreciate your feedback at WordPress.org!
April 20, 2021 20:34:38
eliodata
Topics: 19
Messages: 57
Works like a charm, as usual.

Thank you for your help!
Get News and Updates
Our monthly newsletter keeps you in the loop, so you'll always be up to date with the latest news and updates about E2Pdf.
* You can update your email subscription preferences here.
All trademarks, service marks, trade names, product names, and logos appearing on this website are the property of their respective owners. The use of trademarks such as Formidable Forms®, Forminator Forms®, Gravity Forms®, JetFormBuilder®, WordPress®, WooCommerce®, WPForms® and others is solely for identification purposes (nominative use) and does not imply any affiliation, sponsorship, or endorsement by the respective trademark holders.
© 2017 - 2026, https://e2pdf.com

We use cookies to collect and analyse information on site performance and usage, to provide social media features and to enhance and customise content and advertisements. By clicking "Accept Selected", you consent to use of selected cookies according to our Cookie Policy.