Customize the spam message
add_filter(‘frm_validate_entry’, ‘validate_my_form’, 20, 2); function validate_my_form($errors, $values){ if ( isset($errors[‘spam’]) ) { $errors[‘spam’] = ‘No submissions for you!‘; } return $errors; }Continue reading
Join 2,000,000+ Professionals who use WPCode to Future-Proof Their Websites!
add_filter(‘frm_validate_entry’, ‘validate_my_form’, 20, 2); function validate_my_form($errors, $values){ if ( isset($errors[‘spam’]) ) { $errors[‘spam’] = ‘No submissions for you!‘; } return $errors; }Continue reading
add_filter(‘frm_validate_entry’, ‘check_phone_fields’, 10, 2); function check_phone_fields( $errors, $values ) { if ( $values[‘form_id’] == 45 ) { // change 45 to your form id $group_fields = array(25, 26, 27); // change 25, 26, 27 to the ids of your fields…Continue reading
add_filter(‘frm_validate_entry’, ‘frm_check_ip_blacklist’, 10, 2); function frm_check_ip_blacklist( $errors, $values ) { $ips = array( ‘107.150.42.226‘, ‘195.154.232.138‘, ‘155.108.70.195‘ ); $current_ip = FrmAppHelper::get_ip_address(); if ( in_array( $current_ip, $ips ) ) { $errors[‘spam’] = ‘You are not allowed to do that’; } return $errors;…Continue reading
add_filter(‘frm_validate_field_entry’, ‘my_custom_validation’, 10, 2); function my_custom_validation($errors, $posted_field){ if(!current_user_can(‘administrator’)){ //don’t strip javascript submitted by administrators if(!is_array($_POST[‘item_meta’][$posted_field->id])){ $_POST[‘item_meta’][$posted_field->id] = wp_kses_post($_POST[‘item_meta’][$posted_field->id]); }else{ foreach($_POST[‘item_meta’][$posted_field->id] as $k => $v){ if(!is_array($v)) $_POST[‘item_meta’][$posted_field->id][$k] = wp_kses_post($v); } } } return $errors; }Continue reading
add_filter(‘frm_validate_field_entry’, ‘my_custom_validation’, 10, 3); function my_custom_validation($errors, $posted_field, $posted_value){ if($posted_field->id == 25){ //change 25 to the ID of the field to validate //check the $posted_value here if(strtotime(“-18 years“) < strtotime($posted_value)){ //if birthday is less than 18 years ago //if it doesn’t…Continue reading
add_filter(‘frm_validate_field_entry’, ‘field_caps_validation’, 8, 3); function field_caps_validation($errors, $posted_field, $posted_value){ if($posted_field->type == ‘text’){ $_POST[‘item_meta’][$posted_field->id] = mb_strtoupper($posted_value); } return $errors; }Continue reading
add_filter(‘frm_validate_field_entry’, ‘my_custom_validation’, 10, 3); function my_custom_validation($errors, $posted_field, $posted_value){ $featured_field = 25; //change 25 to the ID of the featured field if ( ! current_user_can(‘administrator’) && $posted_field->id == $featured_field ) { if ( isset( $_POST[‘id’] ) && $_POST[‘id’] ) { $force_val…Continue reading
add_filter(‘frm_validate_field_entry’, ‘frm_check_radio_option’, 10, 3); function frm_check_radio_option( $errors, $posted_field, $posted_value ) { $field_ids = array( 25, 26 ); // set your field ids here if ( in_array( $posted_field->id, $field_ids ) && ! empty( $_POST[‘item_meta’][ $posted_field->id ] ) ) { $options =…Continue reading
add_filter(‘frm_validate_field_entry’, ‘copy_my_field’, 10, 3); function copy_my_field($errors, $posted_field, $posted_value){ if ( $posted_field->id == 25 ) { //change 25 to the ID of the hidden field to change $oDate = $_POST[‘item_meta’][77]; // change 77 to the ID of your date field $_POST[‘item_meta’][$posted_field->id]…Continue reading
add_filter(‘frm_validate_field_entry’, ‘my_custom_validation’, 10, 3); function my_custom_validation($errors, $posted_field, $posted_value){ if($posted_field->id == 125 and !is_admin()){ //change 125 to the ID of the field to validate global $wpdb, $user_ID; $entry_id = (isset($_POST[‘id’])) ? $_POST[‘id’] : 0; $entries = $wpdb->get_col($wpdb->prepare(“SELECT item_id FROM “. $wpdb->prefix…Continue reading