Contact forms for your WordPress website.
- When updating from 1.1.0, you must delete the wpucontactforms/index.php and wpucontactforms/.htaccess.
add_filter('wpucontactforms_default_options', 'wputest__wpucontactforms_default_options', 10, 1);
function wputest__wpucontactforms_default_options($options) {
$fields = array();
$fields['contact_name'] = array(
'autocomplete' => 'name',
'label' => __('Name', 'wpucontactforms'),
'required' => 1
);
$fields['contact_job'] = array(
'label' => __('Job', 'wpucontactforms'),
'conditions' => array(
'display' => array(
'contact_name' => 'boss'
),
'required' => array(
'contact_name' => 'boss'
)
)
);
$fields['contact_email'] = array(
'label' => __('Email', 'wpucontactforms'),
'type' => 'email',
'required' => 1
);
$fields['contact_photo'] = array(
'label' => __('Photos', 'wpucontactforms'),
'type' => 'file'
);
$fields['contact_message'] = array(
'label' => __('Message', 'wpucontactforms'),
'check_excluded_words' => true, # Use excluded words in the settings page
'type' => 'textarea',
'required' => 1
);
return array(
'id' => 'myawesomeform',
'name' => 'My Awesome Form',
'contact__settings' => array(
'group_class' => 'cssc-form cssc-form--default',
'contact_fields' => $fields
)
);
}
<?php do_action('wpucontactforms_content', false, 'myawesomeform');?>
add_action('init', 'launch_wpucontactforms_myawesomeform');
function launch_wpucontactforms_myawesomeform() {
if(!class_exists('wpucontactforms')){
return;
}
new wpucontactforms(array(
'id' => 'myawesomeform',
'name' => 'My Awesome Form',
'contact__settings' => array(
'group_class' => 'cssc-form cssc-form--default',
)
));
}
add_action('wpucontactforms_submit_contactform', 'wpucontactforms_submit_contactform__myawesomeform', 10, 1);
function wpucontactforms_submit_contactform__myawesomeform($formObject) {
// Debug after submit
error_log("The form {$formObject->options['id']} has been submitted");
}
- wpucontactforms_content : ($hide_wrapper = false, $form_id = false) Load contact form.
- wpucontactforms_beforesubmit_contactform : ($formObject) Action before form validation.
- wpucontactforms_submit_contactform : ($formObject) Action after form validation.
- wpucontactforms_fields : (string)
- wpucontactforms_message : (string)
- wpucontactforms_message___maxlinks__nb : (string)
- wpucontactforms_success : (string:html)
- wpucontactforms_settings : (array)
- wpucontactforms_hidden_fields : (array)
- ajax_enabled : true
- attach_to_post : get_the_ID()
- box_class : 'box'
- box_tagname : 'div'
- display_form_after_submit : true
- file_types : 'file_types' => array('image/png','image/jpg','image/jpeg','image/gif'),
- group_class : 'cssc-form cssc-form--default float-form'
- group_submit_class : ''
- group_tagname : 'div'
- input_class : (string) Field classname.
- label_text_required : '*'
- li_submit_class : ''
- max_file_size : 2 * 1024 * 1024
- submit_class : 'cssc-button cssc-button--default'
- submit_label : 'Submit'
- submit_type : 'button' or 'input'
- ul_class : 'cssc-form cssc-form--default float-form'
- value : (string) Default value.
- label : (string) Field name.
- placeholder : (string) Placeholder text in input content.
- classname : (string) Field classname.
- type : (string) Field type : text, url, email, textarea, select, checkbox.
- autofill : (string) User meta ID to autocomplete if user is logged in. user_email works too.
- datas : (array) 1dim array setting datas for select.
- required : (bool) Field is required.
- check_excluded_words : (bool) Field will be checked for excluded words.
- html_before : (string) HTML before LI box.
- html_after : (string) HTML after LI box.
- html_before_checkbox : (string) HTML before a checkbox input.
- html_after_checkbox : (string) HTML after a checkbox input.
- html_before_input : (string) HTML before a common input.
- html_after_input : (string) HTML after a common input.
- box_class : (string) LI Box CSS Class
- validation_pattern : (string) HTML Pattern for validation.
- validation_regexp : (string) Regexp Pattern for validation.
- wpucontactforms__sendmail_intro : (string) HTML before fields values in mail.
- wpucontactforms__sendmail_subject : (string) Subject of the sent email.