Send separate emails for a specific action

add_filter(‘frm_send_separate_emails’, ‘frm_send_separate_emails’, 10, 2); function frm_send_separate_emails( $is_separate, $args ) { if ( in_array( $args[‘action’]->ID, array( 4933, 4924 ) ) ) { $is_separate = true; } return $is_separate; }Continue reading

Don’t validate reCaptcha during API request

add_filter( ‘frm_is_field_hidden’, ‘mark_recaptcha_hidden’, 20, 2 ); function mark_recaptcha_hidden( $hidden, $field ) { $is_api_request = defined( ‘REST_REQUEST’ ) && REST_REQUEST; if ( FrmField::is_field_type( $field, ‘captcha’ ) && $is_api_request ) { $hidden = true; } return $hidden; }Continue reading

Create an entry in another form

add_action(‘frm_after_create_entry’, ‘create_entry_after_submission’, 30, 2); function create_entry_after_submission($entry_id, $form_id){ if ( $form_id != 372 ) {//Change 372 to the ID of Form A return; } $form2 = ‘373‘;//Change 373 to the ID of Form B //Get user if (!isset($_POST[‘frm_user_id’])){ return; } $user…Continue reading

Run code when user saves a draft

add_action(‘frm_after_create_entry’, ‘frm_after_save_draft’, 30, 2); add_action(‘frm_after_update_entry’, ‘frm_after_save_draft’, 30, 2); function frm_after_save_draft($entry_id, $form_id){ if ( $form_id == 221 ) { //change 221 to the ID of your form if ($_POST[‘frm_saving_draft’] == 1) { // do something here } } }Continue reading

Move and rename files

add_action( ‘frm_after_create_entry’, ‘frm_move_file_and_rename’ ); function frm_move_file_and_rename() { $field_ids = array( 25, 26 ); // change field IDs to the IDs of your file upload fields foreach ( $field_ids as $field_id ) { if ( isset( $_POST[‘item_meta’][ $field_id ] ) )…Continue reading

Change date format

add_filter(‘frm_graph_data’, ‘change_my_graph_date_format’, 10, 2); function change_my_graph_date_format( $data, $atts ) { if ( isset( $atts[‘x_axis’] ) && $atts[‘x_axis’] == ‘created_at’ ) { $wp_date_format = get_option(‘date_format’); $new_format = ‘F d’; for ( $i = 1, $l = count( $data ); $i<$l; $i++…Continue reading

Generate a cumulative graph

add_filter(‘frm_graph_data’, ‘generate_cumulative_graph’, 10, 2); function generate_cumulative_graph( $data, $atts ) { if ( isset( $atts[‘title’] ) && $atts[‘title’] == ‘Cumulative graph’ ) { for ( $i=2, $l=count($data); $i<$l; $i++ ) { $data[ $i ][1]+= $data[ $i-1 ][1]; } } return $data;…Continue reading

Skip based on entry creation date

add_filter( ‘frm_skip_form_action’, ‘stop_multiple_actions’, 20, 2 ); function stop_multiple_actions( $skip_this_action, $args ) { if ( $args[‘action’]->ID == 115 && ! $skip_this_action ) { //replace 115 with your action ID if ( is_object( $args[‘entry’] ) ) { $entry = $args[‘entry’]; } else…Continue reading

Skip if the submitter is Admin

add_filter( ‘frm_skip_form_action’, ‘stop_admin_update_email’, 10, 2 ); function stop_admin_update_email( $skip_this_action, $args ) { if ( $args[‘action’]->ID == 115 ) { //replace 115 with your action ID if ( current_user_can( ‘administrator’ ) ) { $skip_this_action = true; } } return $skip_this_action; }Continue reading

Remove All Meta Columns

add_filter( ‘frm_csv_columns’, ‘remove_id_column’, 10, 2 ); function remove_id_column( $headings, $form_id ) { if ( $form_id == 5 ) { //change 5 to your Form ID unset( $headings[‘created_at’] ); unset( $headings[‘updated_at’] ); unset( $headings[‘user_id’] ); unset( $headings[‘updated_by’] ); unset( $headings[‘is_draft’] );…Continue reading