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

Select current user’s option in Dynamic field

add_filter(‘frm_get_default_value’, ‘auto_populate_dynamic_field’, 10, 2); function auto_populate_dynamic_field($new_value, $field){ if ( $field->id == 25 ) { //change 25 to the ID of the Dynamic field global $wpdb; $user = wp_get_current_user(); $entry_id = $wpdb->get_var( $wpdb->prepare( “SELECT id FROM ” . $wpdb->prefix . “frm_items…Continue reading

Hide a field from non-editors

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,127))){ //change 125, 126, and 127 to the ids of fields to hide if(!is_admin() and !current_user_can(‘editor’))//if current user is not an editor $type = ‘hidden’; //hide the fields } return $type; }Continue reading

Hide a field when 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 editing an…Continue reading

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

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