Filter mb_aoi_extensions fails unless at least one item checked in "All-In-One"
Support › Meta Box AIO › Filter mb_aoi_extensions fails unless at least one item checked in "All-In-One"Resolved
- This topic has 12 replies, 3 voices, and was last updated 6 years, 3 months ago by
criv23.
-
AuthorPosts
-
December 28, 2018 at 1:27 AM #12811
Theodore Darling
ParticipantFirst, 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"; }*/ }
January 2, 2019 at 9:25 AM #12841Anh Tran
KeymasterHi 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.
January 2, 2019 at 10:51 PM #12853Theodore Darling
ParticipantHi 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.
January 3, 2019 at 12:39 PM #12863Anh Tran
KeymasterThanks 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.
January 6, 2019 at 12:48 AM #12901criv23
ParticipantI 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.
January 7, 2019 at 5:08 PM #12925Anh Tran
KeymasterHi criv23,
Are you using the latest version 1.6.18? Did the 1.6.17 work for you?
January 8, 2019 at 2:45 AM #12936criv23
ParticipantYes, 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.
January 8, 2019 at 3:11 PM #12944Anh Tran
KeymasterI've just sent you version 1.6.17 via email. Please take a look.
January 8, 2019 at 9:37 PM #12955criv23
ParticipantThanks 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.
January 9, 2019 at 3:24 PM #12962Anh Tran
KeymasterThanks for your feedback. It's strange that I couldn't replicate the bug in the latest version 1.6.18 :(.
January 11, 2019 at 10:22 AM #12981criv23
ParticipantI'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!
January 11, 2019 at 10:40 AM #12983Anh Tran
KeymasterHi criv23,
In the callback filter
mb_aio_extension
, can you change the code toreturn $extensions
instead of$option
and see if it works?January 11, 2019 at 11:28 AM #12987criv23
ParticipantHi Anh,
Switching option to extensions also works in 1.6.17.
-
AuthorPosts
- You must be logged in to reply to this topic.