Limit number of uploaded files

add_filter(‘frm_validate_field_entry’, ‘validate_number_of_files’, 10, 3); function validate_number_of_files($errors, $field, $value){ if ( in_array($field->id, array(25,26,27)) && $field->type == ‘file’ && (isset($_FILES[‘file’.$field->id])) && !empty($_FILES[‘file’.$field->id][‘name’])){ $files = (array)$_FILES[‘file’. $field->id][‘name’]; $count = 0; foreach($files as $n){ if(!empty($n)) $count++; } $existing = $_POST[‘item_meta’][$field->id]; if($existing){ foreach($existing as $e){…Continue reading

Limit the number of times a date can be selected

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 date field $frmpro_settings = FrmProAppHelper::get_settings(); $selected_date = FrmProAppHelper::convert_date($posted_value, $frmpro_settings->date_format, ‘Y-m-d’); //get all the entries for that date $entries_for_date = FrmEntryMeta::get_entry_metas_for_field(125,…Continue reading

Limit responses for a set time period

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 and !is_admin()){ //change 25 to thema ID of the field to validate global $wpdb; $entry_id = (isset($_POST[‘id’])) ? $_POST[‘id’] : 0; $entries = $wpdb->get_col($wpdb->prepare(“SELECT item_id FROM ” . $wpdb->prefix…Continue reading

Show full image instead of thumbnail

add_filter( ‘frm_show_it’, ‘custom_frm_show_it’, 10, 3 ); function custom_frm_show_it( $html, $value, $args ) { if ( $args[‘field’]->id == 30 ) { //change 30 to the id of the upload field in the other form $media_ids = explode( ‘, ‘, $args[‘value’] );…Continue reading

Show option label

add_filter(‘frm_show_it’, ‘dynamic_list_show_option_label’, 10, 3); function dynamic_list_show_option_label( $html, $value, $args ){ if ( $args[‘field’]->id == 485 && $args[‘field’]->field_options[‘separate_value’] ) { foreach ( $args[‘field’]->options as $option ) { if ( is_array( $option ) && isset( $option[‘value’] ) && $option[‘value’] == $value )…Continue reading

Hide a field depending on a value in another

add_filter(‘frm_field_type’, ‘change_my_field_type’, 10, 3); function change_my_field_type($type, $field, $value){ if($field->id == 25){ //change 25 to the id of the field to conditionally hide global $my_required_id, $user_ID; if($my_required_id == $user_ID) //if current user is not an editor $type = ‘hidden’; //hide this…Continue reading

Order options by entry ID

add_filter(‘frm_data_sort’, ‘frm_my_data_sort’, 21, 2); function frm_my_data_sort( $options, $atts ) { if ( $atts[‘dynamic_field’][‘id’] == 100 ) { //change 100 to the ID of the Dynamic field ksort( $options );//sorts options by entry ID } return $options; }Continue reading

Remove duplicates from Dynamic field

add_filter(‘frm_data_sort’, ‘frm_remove_duplicates’, 21, 2); function frm_remove_duplicates( $options, $atts ) { if ( $atts[‘dynamic_field’][‘id’] == 100) { //change 100 to the ID of the Dynamic field $options = array_unique( $options ); } return $options; }Continue reading

Add custom option set

add_filter(‘frm_bulk_field_choices’, ‘add_custom_frm_options’); function add_custom_frm_options( $opts ){ $opts[‘Set Name’] = array(‘Option 1’, ‘Option 2’, ‘Option 3’); return $opts; }Continue reading

Only include categories with no parent

add_filter(‘frm_get_categories’, ‘frm_order_cats’, 10, 2); function frm_order_cats($args, $field){ if($field[‘id’] == 25){ //change 25 to the ID of your field $args[‘parent’] = 0; } return $args; }Continue reading