Show the API response

add_action( ‘frmapi_post_response’, ‘frm_get_api_response’, 10, 3 ); function frm_get_api_response( $response, $entry, $form_action ) { $status = wp_remote_retrieve_response_code( $response ); if ( $status == 200 ) { add_filter(‘frm_main_feedback’, ‘frm_add_200_to_message’ ); } else { add_filter(‘frm_main_feedback’, ‘frm_add_500_to_message’ ); } } function frm_add_200_to_message( $message )…Continue reading

Customize API request headers

add_filter( ‘frm_api_request_args’, ‘my_custom_frm_api_request_header’, 10, 2 ); function my_custom_frm_api_request_header( $arg_array, $args ) { if ( $args[‘url’] == ‘http://test.com’ ) { // the full url where the request is being sent $arg_array[‘headers’][‘my_header_name’] = ‘my_header_value’; $arg_array[‘headers’][‘another_header_name’] = ‘a_header_value’; } return $arg_array; }Continue reading

Convert a meta value to an int

add_filter( ‘frm_api_request_args’, ‘my_custom_function’ ); function my_custom_function( $args ) { $body = json_decode( $args[‘body’], true ); if ( isset( $body[‘owner_id’] ) ) { $body[‘owner_id’] = (int) $body[‘owner_id’]; $args[‘body’] = json_encode( $body ); } return $args; }Continue reading

Add unique validation when saving drafts

add_filter(‘frm_validate_entry’, ‘validate_unique_field’, 10, 2 ); function validate_unique_field( $errors, $values ) { if ( ! FrmProFormsHelper::saving_draft() ) { return $errors; } $field_id = 795; // change this to the ID of the unique field if ( ! isset( $values[‘item_meta’][ $field_id ]…Continue reading

Basic example

add_filter(‘frm_order_lookup_options’, ‘frm_set_custom_lookup_order’, 20, 2); function frm_set_custom_lookup_order( $values, $order ) { if ( $order == ‘ascending’ ) { sort( $values ); } return $values; }Continue reading

Skip start page

add_filter(‘frm_filter_final_form’, ‘skip_start_page’, 15); function skip_start_page( $form ) { $form = str_replace( ‘class=”frm_active_chat_field frm_chat_start_page”‘, ‘style=”display: none;” class=”frm_active_chat_field frm_chat_start_page”‘, $form ); return $form; }Continue reading

Display percentage in pie graph

add_filter(‘frm_google_chart’, ‘frm_pie_chart_tooltip_percentage’, 10, 2); function frm_pie_chart_tooltip_percentage($options, $atts){ if ( $atts[‘type’] == ‘pie’ ) { $options[‘tooltip’] = array(‘text’ => ‘percentage’); } return $options; }Continue reading