Hide a field when not editing

add_filter(‘frm_field_type’, ‘change_my_field_type’, 10, 2); function change_my_field_type($type, $field){ if(in_array($field->id, array(125, 126))){ //change 125 and 126 to the ids of the fields to hide global $frm_vars; if((!is_admin() || defined(‘DOING_AJAX’)) && (!isset($frm_vars[‘editing_entry’]) || !$frm_vars[‘editing_entry’])) { //if not in admin area and not editing…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

Change Date Format

add_filter(‘frm_datepicker_formats’, ‘add_custom_frm_format’); function add_custom_frm_format($formats) { $formats[‘j M, Y‘] = ‘d M, yy‘; //change PHP and Datepicker formats return $formats; }Continue reading

Show all fields on the final page of a multi-paged form

add_filter(‘frm_get_paged_fields’, ‘get_extra_form_fields’, 30, 3); function get_extra_form_fields($fields, $form_id, $error=false){ if($form_id == 25){ //change 25 to the id of the form to change $prev_page = FrmAppHelper::get_param(‘frm_page_order_’. $form_id, false); if($prev_page > 3){ //change 3 to a number higher than the order of second…Continue reading

Remove page breaks from the admin

add_filter( ‘frm_get_paged_fields’, ‘remove_my_breaks’, 9, 2 ); function remove_my_breaks( $fields, $form_id ) { if ( ! is_admin() ) { return $fields; } if ( $form_id == 12 ) { // change 12 to the ID of your form remove_filter( ‘frm_get_paged_fields’, ‘FrmProFieldsHelper::get_form_fields’,…Continue reading

Dynamically populate checkbox field

add_filter(‘frm_setup_new_fields_vars’, ‘frm_set_checked’, 20, 2); function frm_set_checked($values, $field){ if($field->id == 125){//Replace with the ID of your field $values[‘value’] = array($_GET[‘color1‘], $_GET[‘color2‘]); //Replace color1 and color2 with the names of your parameters in the URL } return $values; }Continue reading

Replace field options

add_filter(‘frm_setup_new_fields_vars’, ‘frm_set_checked’, 20, 2); function frm_set_checked($values, $field){ if($field->id == 125){//Replace 125 with the ID of your field $values[‘options’] = array(‘Option 1‘, ‘Option 2‘); //Replace Option1 and Option2 with the options you want in the field } return $values; }Continue reading

Populate a field with WordPress Posts

add_filter(‘frm_setup_new_fields_vars’, ‘frm_populate_posts’, 20, 2); add_filter(‘frm_setup_edit_fields_vars’, ‘frm_populate_posts’, 20, 2); //use this function on edit too function frm_populate_posts($values, $field){ if($field->id == 125){ //replace 125 with the ID of the field to populate $posts = get_posts( array(‘post_type’ => ‘post’, ‘post_status’ => array(‘publish’, ‘private’),…Continue reading

Remove used options

add_filter(‘frm_setup_new_fields_vars’, ‘frm_remove_selected’, 20, 2); function frm_remove_selected($values, $field){ if ( in_array( $field->id, array(100,101,102) ) ) { $used = FrmEntryMeta::get_entry_metas_for_field( $field->id ); if ( $used ) { $used_vals = array(); foreach ( $used as $u ) { if ( is_array( $u )…Continue reading