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

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