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

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

Make field read-only for non-administrators

add_filter(‘frm_setup_new_fields_vars’, ‘frm_set_read_only_on_create’, 9, 2); add_filter(‘frm_setup_edit_fields_vars’, ‘frm_set_read_only_on_create’, 9, 2); function frm_set_read_only_on_create( $values, $field ){ // If on the back-end, keep fields editable if ( FrmAppHelper::is_admin() || current_user_can( ‘administrator’ ) ) { return $values; } // If on front-end, make specific fields…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