Decrease an available count in another form

add_action(‘frm_after_create_entry’, ‘after_entry_created’, 30, 2); function after_entry_created($entry_id, $form_id){ if($form_id == 5){ //change 5 to the ID of your reservations form global $wpdb; $reward_ids = $_POST[‘item_meta’][25]; //change 25 to the ID of your Dynamic dropdown field in your reservations form $seat_count_field =…Continue reading

Update or create another entry

add_action(‘frm_after_create_entry’, ‘update_or_create_entry’, 30, 2); add_action(‘frm_after_update_entry’, ‘update_or_create_entry’, 10, 2); function update_or_create_entry($entry_id, $form_id){ if ( $form_id == 430 ) {//Change 430 to the ID of Form A global $wpdb; $form2 = ‘480‘;//Change 480 to the ID of Form B //Get user and…Continue reading

Clear a field value after email is sent

add_action(‘frm_after_create_entry’, ‘after_entry_created’, 42, 2); function after_entry_created($entry_id, $form_id){ if ( $form_id == 5 ) { //change 5 to the ID of your form FrmEntryMeta::delete_entry_meta($entry_id, 30); // change 30 to your field id } }Continue reading

Populate fields from User ID

add_filter(‘frm_validate_entry’, ‘frm_add_user_name’, 20, 2); function frm_add_user_name( $errors, $values ) { if ( isset( $_POST[‘item_meta’][25] ) ) { //change 25 to the id of the user id field $user = get_userdata( absint( $_POST[‘item_meta’][25] ) ); //change 25 here too $_POST[‘item_meta’][26] =…Continue reading

Change the post parent

add_filter( ‘frm_new_post’, ‘change_my_post_parent’, 10, 2 ); function change_my_post_parent( $post, $args ) { if ( $args[‘form’]->id == 25 ) { //change 25 to the ID of your form $post[‘post_parent’] = 30; //change 30 to the ID of your WP parent page…Continue reading

Use two fields for the title

add_filter( ‘frm_new_post’, ‘change_my_post_title’, 10, 2 ); function change_my_post_title( $post, $args ) { if ( $args[‘form’]->id == 25 ) { //change 25 to the ID of your form $title = $_POST[‘item_meta’][20] .’ ‘. $_POST[‘item_meta’][21] .’ ‘. $_POST[‘item_meta’][22] .’ ‘. $_POST[‘item_meta’][23]; //change…Continue reading

Create products in EDD

add_filter(‘frm_new_post’, ‘edd_setup_files’, 10, 2); function edd_setup_files($post, $args) { if ( $args[‘form’]->id != 5 ) { //change 5 to the ID of your form return $post; } global $frm_vars; // don’t continue if no files were uploaded if( ! isset( $frm_vars[‘media_id’]…Continue reading

Save custom date format in custom field

add_filter( ‘frm_new_post’, ‘create_a_custom_field’, 10, 2 ); function create_a_custom_field( $post, $args ) { $field_id = 25; // change 25 to the id of the field to draw from if ( isset( $_POST[‘item_meta’][ $field_id ] ) ) { $field_value = sanitize_text_field( $_POST[‘item_meta’][…Continue reading

Save a due date

add_filter(‘frm_add_entry_meta’, ‘change_due_date’); function change_due_date($new_values) { if($new_values[‘field_id’] == 6103 and !is_admin()) { // 776 is the Due Date field on the form – note that this field must have a value in it on form submit or this code will not…Continue reading

Send email after submitting comment

add_filter(‘frm_add_entry_meta’, ‘custom_change_field_value’); function custom_change_field_value($new_values){ if($new_values[‘field_id’] == 0){ //0 indicates this is a comment $subject = ‘New comment‘; //change email subject here $send_to = array(‘[email protected]’, ‘[email protected]‘); //set email addresses here $info = maybe_unserialize($new_values[‘meta_value’]); $message = $info[‘comment’]; foreach($send_to as $to) wp_mail($to, $subject,…Continue reading