Closed reklamasieciowa closed 1 year ago
So you mean that the line https://github.com/WPBP/WordPress-Plugin-Boilerplate-Powered/blob/master/plugin-name/backend/ImpExp.php#L112 is not valid? For php https://www.php.net/manual/en/function.file-get-contents.php that method return false if the file is not found.
Also the updated messages is just a dummy notice like the others is not involved in this. Also if it is failing you get an alert "Failed to import the settings." otherwise there is a redirect, can you explain better what is happening in your case?
This line is ok. $setting_file get the data and it is NOT empty. https://github.com/WPBP/WordPress-Plugin-Boilerplate-Powered/blob/master/plugin-name/backend/ImpExp.php#LL114C3-L114C3 check if it is empty.
Try to add: if ( !$settings_file ) { \wp_die($settings_file);
wp_die() will not run, because if ( !$settings_file ) return false.
I've setup blank project with wpbp-generator, exported settings and import does not work. :)
So the file is not found, I will do some tests.
You are right, I did a tiny patch in a commit but before to do a new release I will wait some weeks for other stuff.
Hi, I've found the real issue with import settings. The form file field name is not updated during code generation: https://github.com/WPBP/WordPress-Plugin-Boilerplate-Powered/blob/master/plugin-name/backend/ImpExp.php#L94
My code from generator: 94-96: if ( !isset( $_FILES[ 'pn_import_file' ][ 'name' ] ) ) { return; } The form field name is _lmc_importfile in my case. 97: file_name_parts = \explode( '.', $_FILES['lmc_import_file']['name'] );
I will check in the generator, thanks for investigating
I tested the altest generator version with the latest boilerplate version and this issue is not happening. Are you using the latest version for the generator?
Hmm. There is no --v option. ;) Last download 18.05.2023. If there is no issue now, just close this topic. ;)
Backend/ImpExp.php update_option never got called because of if ( !$settings_file ).
To Reproduce Steps to reproduce the behavior: