My site is built using Elementor Pro, Custom Post Types, and Advanced Custom Fields. I have a single post template built in Elementor for a custom post type. The template has buttons for downloading files. The button links are currently set up to dynamically pull in a URL from a custom field.
The download URL editing process is as follows:
1. User clicks to edit or add a new post. This takes place in the WP editor, not in Elementor (the post is connected to the custom post type configured in CPT UI plugin)
2. User enters a URL for the download button into the custom field (field has been configured using ACF Pro plugin)
My issue is that WPDM uses shortcodes to link to the download package but I need a URL in this case. Do you know of a solution for my scenario? I want to keep my button designs within the Elementor template, and use ACF Pro to dynamically connect the download to the button.
I am getting the same error message as listed here.
https://www.wpdownloadmanager.com/support/topic/wpdm_accordion_gbblock-php-on-line-52-and-53-2
Which is listed as resolved but the resolution is set as private. So here we go.
The plugin appears to work on the frontend but it crashes the backend/admin side.
[Thu Sep 01 16:12:32.787361 2022] [php:error] [pid 10475] [client 10.1.100.15:50368] PHP Fatal error: Uncaught TypeError: basename(): Argument #1 ($path) must be of type string, array given in /var/www/html/cms/wp-content/plugins/wpdm-accordion/libs/GutenbergBlock/WPDM_Accordion_GBBlock.php:52\nStack trace:\n#0 /var/www/html/cms/wp-content/plugins/wpdm-accordion/libs/GutenbergBlock/WPDM_Accordion_GBBlock.php(52): basename()\n#1 /var/www/html/cms/wp-includes/class-wp-hook.php(307): WPDM_Accordion_GBBlock->linktemplatesJSON()\n#2 /var/www/html/cms/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters()\n#3 /var/www/html/cms/wp-includes/plugin.php(476): WP_Hook->do_action()\n#4 /var/www/html/cms/wp-admin/admin-header.php(163): do_action()\n#5 /var/www/html/cms/wp-admin/index.php(137): require_once(‘…’)\n#6 {main}\n thrown in /var/www/html/cms/wp-content/plugins/wpdm-accordion/libs/GutenbergBlock/WPDM_Accordion_GBBlock.php on line 52
The Function in question
function linktemplatesJSON()
{
$templates = WPDM()->packageTemplate->getTemplates('link', true);
$_templates = [];
foreach ($templates as $templateID ► $template) {
$template = WPDM()->packageTemplate->getInfo(basename($template), 'link');
$_templates[] = ['label' ► $template['name'], 'value' ► $templateID];
}
?>
<script>
var __wpdmacrd_link_templates = <?= json_encode($_templates); ?>;
</script>
<?php
}
The specific line
$template = WPDM()->packageTemplate->getInfo(basename($template), ‘link’);
If I comment out that line then it hops to the next line
[Thu Sep 01 16:19:00.782022 2022] [php:error] [pid 10057] [client 10.1.100.15:50797] PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /var/www/html/cms/wp-content/plugins/wpdm-accordion/libs/GutenbergBlock/WPDM_Accordion_GBBlock.php:53\nStack trace:\n#0 /var/www/html/cms/wp-includes/class-wp-hook.php(307): WPDM_Accordion_GBBlock->linktemplatesJSON()\n#1 /var/www/html/cms/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters()\n#2 /var/www/html/cms/wp-includes/plugin.php(476): WP_Hook->do_action()\n#3 /var/www/html/cms/wp-admin/admin-header.php(163): do_action()\n#4 /var/www/html/cms/wp-admin/index.php(137): require_once(‘…’)\n#5 {main}\n thrown in /var/www/html/cms/wp-content/plugins/wpdm-accordion/libs/GutenbergBlock/WPDM_Accordion_GBBlock.php on line 53
If I comment out that line then it allows me to continue and I get no further errors.
I do have some custom accordian templates. I am on php 8.1 and can give you more details if you need them.
Brian
Is there a way to display the URL from the page the download link is executed from? We have the same file that will be downloadable from multiple pages, and the page the file is downloaded from helps us understand the customer’s interests. Is there a template variable for this?
Hello,
We use this plugin to provide visitors a unique URL for downloading pdf’s from our site. I’m attempting to upgrade from (very old) version 4.6.8 to the current version. Most of the configuration come across fine, but after the upgrade when a user get the download email the link contains only the section after “/?post_type”. The new link is missing the https://yyy.com
Example:
before update: https://yyy.com/?post_type=wpdmpro&p=2515&wpdmdl=2515&_wpdmkey=asdfasfasd
after update: /?post_type=wpdmpro&p=2515&wpdmdl=2515&_wpdmkey=asdfasfasd&subscriber=adsfasdfasdfas
How can I fix this? Where should I be looking to update this information?
Thanks!
Hi,
Is there a way I can create a link for a user to download a package? & then when they click that link the popup will ask for their email before downloading.
Thanks
I have been using this for a couple of years, but it stopped working recently. When you click on the link, nothing happens.
When it was originally setup, i followed the instructions here https://www.wpdownloadmanager.com/how-to-add-modal-popup-login-form-in-your-wordpress-site/
And yes it is enabled in front end settings, [wpdm_login_form] is already on the login page and selected in front end settings.
Like i said earlier. I have been using this for a couple of years and it recently stopped working.
Hi we have a problems for your plugin, we have customer who submit their email for download our documents, but some of them can download success, someone can not. i checked our subscribe and we find there have different status, of “approved” and “downloaded”
why it like this ? The customer just showed approved who can not download. i attached you the pictures.
for the downloaded, we not know if they download it success or not.
Here is our link:
please advice and help. thanks.