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

Remove option used variable times

add_filter(‘frm_setup_new_fields_vars’, ‘frm_remove_selected’, 20, 2); function frm_remove_selected($values, $field) { $quantity_field = ‘frm-inquantity‘; // change to the field key for the quantity field in the other form $signup_field = ‘frm-signup-item‘; // change to the field key of the dynamic field that should…Continue reading

Remove option after n submissions

add_filter(‘frm_setup_new_fields_vars’, ‘frm_remove_full_option’, 20, 2); function frm_remove_full_option($values, $field){ if ( in_array( $field->id, array( 426, 427, 428 ) ) ) { $submitted_values = FrmEntryMeta::get_entry_metas_for_field( $field->id ); if ( $submitted_values ) { // Break out multi-dimensional array for checkbox field values if (…Continue reading

Remove an option

add_filter(‘frm_setup_new_fields_vars’, ‘remove_field_option’, 30, 2); add_filter(‘frm_setup_edit_fields_vars’, ‘remove_field_option’, 30, 2); function remove_field_option( $values, $field ) { if ( $field->id == 25 ) { // change 25 to your field id $options_to_remove = array( ‘12:00 PM‘, ‘12:30 PM‘ ); foreach ( $options_to_remove as…Continue reading

Display User ID dropdown on front-end for admin

add_filter(‘frm_setup_new_fields_vars’, ‘show_user_dropdown’, 15, 2); add_filter(‘frm_setup_edit_fields_vars’, ‘show_user_dropdown’, 15, 3); function show_user_dropdown($values, $field, $entry_id=false){ $action = FrmAppHelper::get_param( ‘action’, ”, ‘post’, ‘sanitize_text_field’ ); $creating_field = FrmAppHelper::doing_ajax() && ( $action === ‘frm_insert_field’ || $action === ‘frm_duplicate_field’ ); if ( $values[‘type’] == ‘user_id’ && !…Continue reading

Filter Dynamic Field

add_filter(‘frm_setup_new_fields_vars’, ‘filter_dfe_options’, 25, 2); function filter_dfe_options($values, $field){ if ( $field->id == 125 && !empty( $values[‘options’] ) ) {//Replace 125 with the ID of your Dynamic field $temp = $values; $temp[‘form_select’] = 30;//change 30 to the id of the field (in…Continue reading

Show admin all options in a filtered dynamic field

add_filter(‘frm_setup_new_fields_vars’, ‘do_not_restrict_admin’, 20, 2); function do_not_restrict_admin( $values, $field ) { if ( $values[‘restrict’] && current_user_can(‘administrator’) ) { if ( $values[‘type’] == ‘data’ && in_array( $values[‘data_type’], array( ‘select’, ‘radio’, ‘checkbox’ ) ) && is_numeric( $values[‘form_select’] ) ) { $values[‘restrict’] = 0;…Continue reading