Replies: 3
Hi,
I have this custom plugin that I made, so this plugin will “add” a form whenever the plugin is activated. here’s the code sample:
function add_theme_color_form()
{
if (!get_option('initial_terms_added_tcolor')) {
// first run;
$wrappers = array(
array(
'wrapper_id' => 'wrapper-2630-6454',
'fields' => array(
array(
'element_id' => 'text-1',
'type' => 'name',
'cols' => '12',
"field_label" => __("Theme Colour", 'forminator'),
"placeholder" => __("E.g. text placeholder", 'forminator'),
'custom-class' => 'colorpicker',
)
)
)
);
$settings = array(
"formName" => 'Theme Color Selector',
"thankyou" => "true",
"thankyou-message" => __("Setting saved", 'forminator'),
"use-custom-submit" => "true",
"custom-submit-text" => __("Apply Selection", 'forminator'),
"use-custom-invalid-form" => "true",
"custom-invalid-form-message" => __("Error: Your form is not valid, please fix the errors!", 'forminator')
);
$notifications = array();
Forminator_API::add_form(
'Theme Color Selector',
$wrappers,
$settings,
$notifications
);
add_option('initial_terms_added_tcolor', 1);
}
}
the problem that I’m having is that sometimes the form is set as published, sometimes its still set as draft. What i need and expect is it’s set as Published 100% everytime. Is there a way to always set the form as Published?
I know there’s a line to set on the json export to set it as published but how do you do it programatically using the code sample above?
thanks again!