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

Use a custom class for the success message

add_filter( ‘frm_main_feedback’, ‘frm_custom_feedback_class’, 20, 3 ); function frm_custom_feedback_class( $message, $form, $entry_id ) { if ( $form->id == 125 ) { //Replace with the ID of your form $message = str_replace(‘frm_message’, ‘my_custom_class’, $message ); } return $message; }Continue reading

Show a message when trying to edit

add_action(‘frm_display_form_action’, ‘close_my_form’, 20, 3); function redirect_edit_form( $params, $fields, $form ) { global $frm_vars; $edit_attempt = isset( $_GET[‘entry’] ); $editing_entry = isset( $frm_vars[‘editing_entry’] ) ? $frm_vars[‘editing_entry’] : 0; if ( $edit_attempt && ! $editing_entry ) { echo ‘You do not have…Continue reading

Populate a field with categories

add_filter(‘frm_setup_new_fields_vars’, ‘frm_populate_categories’, 20, 2); add_filter(‘frm_setup_edit_fields_vars’, ‘frm_populate_categories’, 20, 2); function frm_populate_categories( $values, $field ) { if ( $field->id == 125 ) { //replace 125 with the ID of the field to populate // Adjust your category aruments as needed $category_args =…Continue reading

Auto populate multiple rows in a repeater

add_filter(‘frm_setup_new_fields_vars’, ‘frm_auto_populate_repeating_fields’, 20, 2); function frm_auto_populate_repeating_fields( $values, $field ) { if ( $field->id == 24094 ) {//Replace with the ID of your field if ( ! isset( $_POST[‘item_meta’][ $field->id ] ) ) { $first_field = 123; $second_field = 124; $values[…Continue reading

Store uploaded file URL in custom field

add_filter( ‘frm_new_post’, ‘create_a_custom_field’, 10, 2 ); function create_a_custom_field( $post, $args ) { $field_id = 25; // change 25 to the id of the file upload field if ( isset( $_POST[‘item_meta’][ $field_id ] ) ) { $field_value = sanitize_text_field( $_POST[‘item_meta’][ $field_id…Continue reading

Save entry ID in custom field

add_filter( ‘frm_new_post’, ‘frm_save_entry_id_to_custom_field’, 10, 2 ); function frm_save_entry_id_to_custom_field( $post, $args ) { if ( $args[‘form’]->id == 25 ) { //change 25 to the ID of your form $post[‘post_custom’][‘my_custom_field’] = $args[‘entry’]->id; } return $post; }Continue reading

Combine date and time

add_filter( ‘frm_validate_field_entry’, ‘frm_combine_date_time’, 8, 2 ); function frm_combine_date_time( $errors, $posted_field ) { $date_field = 25; // change 25 to the id of your date field $time_field = 26; // change 26 to the id of your time field $combo_field =…Continue reading