-
Hi,
I've set 'default' on every Section Field. While I'm testing for output. There're lots of errors like 'undefined $variable'.I'm seeing that If I don't hit "Save" button the data will not available for output or not saving to Options data. Since, it's a problem for me to avoid these kind of errors.
I've checked all setting parameters available of Options.
I want to save all data while plugin activation/load. So, anyone will not see this kind of warnings/errors.
Please let me know the best solution for this.
Thanks
Posted 2 years ago # -
Another thing, there's an option 'min' and 'max' for 'group' type fields.
Can I set Custom Message for 'max' value?
Like 'You need to upgrade' or anything I want?Thanks
Posted 2 years ago # -
Hi,
Hmm default value saving when activate plugin or run framework. But do not forget this scenerio. (for eg.) Suppose you used "litonarefin-options" prefix and run. Then if you set a new field and default value it will not save. because framework will checks if exists "litonarefin-options".
Shortly I mean, try this before test.
delete_option( 'litonarefin-options' );
CopyCopied!or try it on a clean wp installation. If still same, I'll check it again. maybe there is an bug.
It's not possible with current release. but yes It's possible wit a little edit.
'min_text' => 'Ops min: you need something.', 'max_text' => 'Ops max: you need something.',
CopyCopied!maybe like this ?
Regards, Codestar
Posted 2 years ago # -
I think it's not saving data while plugin installation. It should compare data with "litonarefin-options". If data are changed/updated on Settings Array with default value, it should save on "litonarefin-options" immediately with default value if there's a change.
Neither users can't do anything without "Saving" data. I think this is a big problem if I updated options later.Please think about the scenario. It's just an extra condition but life saver for Developers.
Thanks
Posted 2 years ago # -
Hi,
Nobody reported this issue, yet. I have tested again and it saves the defaults when the plugin install/run in my side.
Btw, how you call the options ? Write to me your get_option idea.
Regards, Codestar
Posted 2 years ago # -
I'm also interested in this.
I'm using CodeStar inside WordPress Plugin Boilerplate https://github.com/devinvinson/WordPress-Plugin-Boilerplate/ where there is a plugin 'activator' class (https://github.com/DevinVinson/WordPress-Plugin-Boilerplate/blob/master/plugin-name/includes/class-plugin-name-activator.php) with an empty activate() function.
How do I initiate the saving of all default values for fields when plugin is activated?... In other words, what do I need to do inside the activate() function so codestar not only saves an empty options, e.g. a
{s
"options_tabs";s
"";}, but saves all the default values defined in the fields arrays? e.g.
array(
'id' => 'enable',
'type' => 'switcher',
'title' => 'Enable?',
'text_on' => 'Yes',
'text_off' => 'No',
'default' => true,
),In this example, I'm trying to enable a back-to-top button displayed on the front end when the plugin is activated.
Perhaps this should be done from elsewhere (e.g. directly inside CodeStar options code) and not inside the activate() function?
I couldn't find anything in the documentation on this.
Thanks!
Posted 1 year ago # -
Hi,
Actually, it's saves default values. but it should be run once. There is no way for save default with another way. It's same for all frameworks.
Regards, Codestar
Posted 1 year ago #