Support Forum
Support › MB Settings Page › Backup & Restore not working with Composer loadingResolved
I'm using loading meta box and all extensions through composer for my plugin. I am currently trying to setup the Backup & Restore field type but it doesn't seem to work when using composer. I tested this feature by installing/activating the all in one plugin, enabling the Settings extension and then the textarea seemed to show up correctly... Though, it still didn't contain json of my saved settings. Is this feature fully functional yet?
Thanks!
Hi Joe,
Could you please share the code to create the Settings page and Backup & Restore field type? I will take a closer look and check it on my end.
For sure. The code is below. I have removed other tabs for simplicity. Thanks for the help!
/**
* Register settings pages
*
* @since 3.0
* @access public
* @var array $settings_pages
*/
function ditty_settings_pages() {
$settings_pages[] = array(
'id' => 'ditty_settings',
'option_name' => 'ditty_settings',
'menu_title' => __( 'Settings', 'ditty-news-ticker' ),
'capability' => 'manage_ditty_settings',
'parent' => 'edit.php?post_type=ditty_ticker',
'style' => 'no-boxes',
'columns' => 2,
'tabs' => array(
'backup' => __( 'Backup & Restore', 'ditty-news-ticker' ),
),
);
return $settings_pages;
}
add_filter( 'mb_settings_pages', 'ditty_settings_pages' );
/**
* Register settings metaboxes
*
* @since 3.0
* @access public
* @var array $meta_boxes
*/
function ditty_settings_metaboxes( $meta_boxes ) {
$meta_boxes[] = array(
'id' => 'backup',
'title' => __( 'Backup & Restore', 'ditty-news-ticker' ),
'settings_pages' => 'ditty_settings',
'tab' => 'backup',
'fields' => array(
array(
'name' => __( 'Backup & Restore', 'ditty-news-ticker' ),
'type' => 'backup',
),
),
);
return $meta_boxes;
}
add_filter( 'rwmb_meta_boxes', 'ditty_settings_metaboxes' );
Hi,
I'm using the sample code from the documentation
'fields' => array(
array(
'name' => 'Logo',
'id' => 'logo',
'type' => 'file_input',
),
array(
'name' => 'Layout',
'id' => 'layout',
'type' => 'image_select',
'options' => array(
'sidebar-left' => 'https://i.imgur.com/Y2sxQ2R.png',
'sidebar-right' => 'https://i.imgur.com/h7ONxhz.png',
'no-sidebar' => 'https://i.imgur.com/m7oQKvk.png',
),
),
array(
'name' => __( 'Backup & Restore', 'ditty-news-ticker' ),
'type' => 'backup',
),
),
and the field type backup
works as well, see my screen record https://cl.ly/303ff96d3190.
Could you please try to clear the cache and check this field again?
Are you loading metabox and the settings extension through composer? I am able to get it working when loading metabox through the standalone plugins or the AIO plugin. But, when I switch to just using composer (with latest available files) it still doesn't work. See screenshots.
Hi Joe,
I've just set up a simple test plugin with nothing than just Meta Box + MB Settings Page and I see the backup & restore field works properly. Please see my video for details:
Thanks for looking into this. I'm not seeing any difference between my setup and what you are showing, but it still doesn't seem to work. Can you take a look at my video and let me know if you see anything wrong with my process? (I have a license code, but cleared it out for the video)
https://www.loom.com/share/d6ee367f782f4d259137643177156b49
Thanks!
Strange, I see it's similar to my setup. I can think only about the downloaded version via Composer. Can you check the files in the vendor folder to see if they're the same as in the individual plugin?
It seems my composer package was loading version 1.3.4 of the settings page, as opposed to version 2.1.0 of the single plugin... I'm not sure why.
I had run composer update, but for some reason the packages weren't updating. I trashed all the packages and re-ran composer update to install them all fresh again and now have the latest versions.
All seems to be working fine now. Thanks again for the support!