Support Forum
Support › Meta Box AIO › Filter mb_aoi_extensions fails unless at least one item checked in "All-In-One"Resolved
First, if there are no modules checked in the "all-in-one" settings page, then the filter "mb_aio_extensions" never gets called. I'll add my code change below that makes this work for me.
Next, even if the options are changed in the filter, they don't show as checked for the page.
Finally, every time I un-check the dashboard, it just returns filled back in.
Here is the code that I changed in the file class-mb-aio-loader.php that shows the content in the menu, but it doesn't check the boxes. Maybe it can be updated in the next version. Original code commented out.
public function load_premium_extensions() {
$option = get_option( 'meta_box_aio' );
// Change the commented below to this. Otherwise, unless there is an extension already selected,
// the code below will never call the filter.
// Allows developers to filter the list of premium extensions.
$extensions = apply_filters( 'mb_aio_extensions', $option['extensions'] );
if ( ! is_array( $extensions ) || empty( $extensions ) ) {
return;
}
foreach ( $extensions as $extension ) {
require_once dirname( __FILE__ ) . "/extensions/$extension/$extension.php";
}
/*
$option = get_option( 'meta_box_aio' );
if ( empty( $option['extensions'] ) ) {
return;
}
// Allows developers to filter the list of premium extensions.
$extensions = apply_filters( 'mb_aio_extensions', $option['extensions'] );
if ( ! is_array( $extensions ) ) {
return;
}
foreach ( $extensions as $extension ) {
require_once dirname( __FILE__ ) . "/extensions/$extension/$extension.php";
}*/
}
Hi Theodore,
Thanks a lot for your feedback. I've fixed 2 first issues. Will release new version soon.
Regarding the last issue, if you run the filter to enable an extension, then it's always enable, even if you uncheck from the list. The filter has higher priority than the option.
Hi Anh,
I understand if adding a filter to enable an extension. And I know that the extensions are enabled whether or not they are checked.
My third point was in relation to the "Dashboard" checkbox above the extensions. Un-checking that doesn't remove anything from the dashboard and when the page is refreshed, it remains checked.
Thanks a lot for your feedback! I've just updated the AIO extension with fixes for these bugs. Please update and let me know if there's anything wrong.
I may be experiencing the same issue. Any extensions I select do not remain checked. I also have them set in a filter but they are still showing as unchecked:
add_filter( 'mb_aio_extensions', function( $extensions ) {
$extensions = ['mb-admin-columns','mb-settings-page','mb-user-meta','meta-box-builder','meta-box-columns','meta-box-conditional-logic','meta-box-group','meta-box-show-hide','meta-box-tabs','meta-box-updater','mb-term-meta'];
return $option;
} );
The same can be said for the Dashboard checkbox like Theodore mentioned.
I can tell the plugins are not activated because my tabs, groups, etc. are not displaying correctly. If I install one of the plugins separately (e.g. meta-box-tabs), my tabs show up correctly. This was working fine around 12/26.
Any help would be appreciated.
Hi criv23,
Are you using the latest version 1.6.18? Did the 1.6.17 work for you?
Yes, I'm using 1.6.18. I believe it was working on 1.6.17 or 1.6.16.
Whatever version it was on during 12/26 is when it was working. Is there a way to download previous releases? If so, I can let you know which version was working.
I've just sent you version 1.6.17 via email. Please take a look.
Thanks Anh! I just tested 1.6.17 and that does work for me. So something in 1.6.18 is causing it to not save the data.
Thanks for your feedback. It's strange that I couldn't replicate the bug in the latest version 1.6.18 :(.
I'm not sure what's causing it either. I deactivated every other plugin when I had 1.6.18 installed and it still wasn't working so it couldn't have been a compatibility issue.
Here are the only two metabox filters I have in my functions.php :
add_filter( 'mb_aio_load_free_extensions', '__return_false' );
add_filter( 'mb_aio_extensions', function( $extensions ) {
$extensions = ['mb-admin-columns','mb-settings-page','mb-user-meta','meta-box-builder','meta-box-columns','meta-box-conditional-logic','meta-box-group','meta-box-show-hide','meta-box-tabs','meta-box-updater','mb-term-meta'];
return $option;
} );
Let me know if you need any more info and I can help!
Hi criv23,
In the callback filter mb_aio_extension
, can you change the code to return $extensions
instead of $option
and see if it works?
Hi Anh,
Switching option to extensions also works in 1.6.17.