Closed ControlZetaDigital closed 1 year ago
Thanks for the note. Why not send a PR for this bug?
The bug appears here as well. Same has been done, imported a .json file with settings, and since then (I'm using multisite) I cannot edit any settings on any sites in adminize, because it always throws an error (but only on the frontend, so it does work, when some settings has to be hidden, fortunately). Going on Adminize 1.11.8 with WordPredd 6.1.1
Hi all, sorry I've just read your response @bueltge
@borsodigerii thanks for sending PR of the fix that I suggested, I was about to send it right now but you were faster
Thanks a lot for the feedback and the PR. The new version should be public in view minutes on wp.org.
Description of the bug
Hi
When you import a JSON file with options exported from another website, even if the websites are exactly the same, the plugin throws a fatal error on line 87 of the file '/inc-options/admin_bar_frontend.php'.
I have detected the problem here: Line 81:
foreach ( $admin_bar_frontend_items as $key => $value ) {
I don't know why it happens, but when you import a json file with options, the variable
$value
is no longer an object, but an array.I've solve the problem adding this line of code just after the foreach line:
$value = (is_object($value)) ? $value : (object) $value;
If this is a common bug, I hope this can help to solve it.
Cheers
Reproduction instructions
Expected behavior
Don't get a fatal error when importing options
Environment info
Relevant log output
No response
Additional context
No response
Code of Conduct