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

Blackout Time Blocks

add_filter(‘frm_allowed_times’, ‘change_my_business_hours’, 10, 2); function change_my_business_hours($remove, $values) { if ( $values[‘time_field’] == ‘field_mflcim’) { //change to field key for your time field $week_day = date(‘l’, strtotime($values[‘date’])); $times_to_remove = array( ‘Monday’ => array(’05:15 PM’, ’05:30 PM’, ’05:45 PM’, ’06:00 PM’), //continue…Continue reading

Change to like

add_filter( ‘frm_set_comparison_type_for_lookup’, ‘customize_lookup_value_retrieval’, 10, 3); function customize_lookup_value_retrieval( $type, $parent_field, $child_field ) { if ( $parent_field->id == 123 ) { $type = ‘like’; } return $type; }Continue reading

Set fields to read-only when editing

add_filter(‘frm_setup_edit_fields_vars’, ‘frm_set_read_only’, 20, 3); function frm_set_read_only($values, $field, $entry_id){ // If on the back-end, keep fields editable if ( FrmAppHelper::is_admin() ) { return $values; } // If on front-end, make specific fields read-only if ( in_array( $field->id, array( 1558,554,555,556 ) )…Continue reading

Set field value when editing

add_filter(‘frm_setup_edit_fields_vars’, ‘frm_set_edit_val’, 20, 3); function frm_set_edit_val( $values, $field, $entry_id ) { if ( $field->id == 171 ) { //Replace 171 with your field ID // If on the back-end, don’t adjust field value if ( FrmAppHelper::is_admin() ) { return $values;…Continue reading

Set the default value of a field

add_filter(‘frm_get_default_value’, ‘my_custom_default_value’, 10, 3); function my_custom_default_value( $new_value, $field, $is_default ) { if ( $field->id == 25 && $is_default ) { //change 25 to the ID of the field $new_value = ‘default’; //change ‘default’ to your default value } return $new_value;…Continue reading

Conditionally switch default value

add_filter(‘frm_get_default_value’, ‘switch_my_default_value’, 10, 2); function switch_my_default_value( $new_value, $field ){ if ( in_array( $field->id, array( 25, 26, 27 ) ) ) { if ( isset( $_GET[‘pass_entry’] ) ) { $new_value = do_shortcode( ‘[frm-field-value field_id=’ . $field->id . ‘ entry=pass_entry]’ ); }…Continue reading

Populate a field with the original referring url

add_filter(‘frm_get_default_value’, ‘my_custom_default_value’, 10, 2); function my_custom_default_value($new_value, $field){ if($field->id == 25){ //change 25 to the ID of the field $new_value = reset($_SESSION[‘frm_http_referer’]); //stores the value of the referring URL } return $new_value; }Continue reading