Modify field types in order

add_filter( ‘wc_fp_exclude_fields’, ‘frm_adjust_exclude_fields’ ); function frm_adjust_exclude_fields( $exclude ) { $key = array_search( ‘textarea’, $exclude ); if ( $key !== false ) { unset( $exclude[ $key ] ); } return $exclude; }Continue reading

Include or exclude fields in cart

add_filter( ‘wc_fp_include_field_in_cart’, ‘frm_show_field_in_cart’, 10, 3 ); function frm_show_field_in_cart( $display, $field, $value ) { if ( in_array( $field->id, array( ‘123’, ‘345’, ‘456’ ) ) ) { $display = true; } else if ( in_array( $field->id, array( ‘987’, ‘765’, ‘543’ ) )…Continue reading

Validate password field

add_filter(‘frm_validate_field_entry’, ‘check_user_pass’, 10, 3); function check_user_pass($errors, $posted_field, $posted_value){ if($posted_field->id == 6369){ //change 6369 to the ID of the password field to validate if(!preg_match(‘/^(?=.*[A-Za-z])(?=.*d)[A-Za-z!@#$%&*()?d]{8,}$/’, $posted_value)) { $errors[‘field’. $posted_field->id] = ‘Password must be at least 8 characters long and contain at least…Continue reading

Combine auto increment field with another field

add_filter(‘frm_validate_field_entry’, ‘combine_auto_id_with_field’, 15, 3); function combine_auto_id_with_field( $errors, $posted_field, $posted_value ) { if($posted_field->id == 56){ //change 56 to the ID of the destination field $_POST[‘item_meta’][56] = $_POST[‘item_meta’][54] . $_POST[‘item_meta’][55]; //change 54 and 55 to the IDs of the auto increment field…Continue reading

Calculate time between dates + times

add_filter(‘frm_validate_field_entry’, ‘calculate_time’, 11, 3); function calculate_time($errors, $field, $value){ if($field->id == 30){ //change 30 to the ID of the hidden or admin only field which will hold the calculation $start_date = date_create_from_format( ‘m/d/Y’, $_POST[‘item_meta’][23] ); // Change 23 to the ID…Continue reading

Remove options based on filters

add_filter( ‘frm_setup_new_fields_vars’, ‘frm_remove_filtered’, 20, 2 ); function frm_remove_filtered( $values, $field ) { if ( $field->id !== “577” ) { return $values; } $used_string = FrmProDisplaysController::get_shortcode( array( ‘id’ => 159, ‘filter’ => 0 ) ); if ( ! $used_string ) {…Continue reading

Black out specific dates

add_filter(‘frm_selectable_dates’, ‘frm_black_out_specific_dates’, 10, 2); function frm_black_out_specific_dates( $selectable, $args ) { if ( $args[‘field’]->field_key == ‘pcm7rl3‘ ) { //replace pcm7rl3 with your field key $selectable = ‘( y+”-“+m+”-“+d != “2017-5-29” && y+”-“+m+”-“+d != “2017-7-4” )’; } return $selectable; }Continue reading

Disable datepicker on mobile

add_filter( ‘frm_field_classes’, ‘frm_remove_date_field_class’, 30, 2 ); function frm_remove_date_field_class( $class, $field ) { if ( $field[‘type’] == ‘date’ && wp_is_mobile() ) { $class = str_replace(‘ frm_date’, ”, $class ); } return $class; }Continue reading

Exclude an entry

add_filter( ‘frm_entries_list_query’, ‘set_listed_entries’, 10,2 ); function set_listed_entries( $where, $atts ) { $form_id = 2; // set to your form id if ( $atts[‘form_id’] == $form_id && ! current_user_can(‘administrator’) ) { // who should not see the form? $where[‘it.id !’] =…Continue reading