Conditionally stop email

add_filter(‘frm_to_email’, ‘stop_the_email’, 10, 4); function stop_the_email($recipients, $values, $form_id, $args){ if ( $form_id == 5 && $args[’email_key’] == 123 ) { //change 5 to the id of the form and 123 to the ID of your email notification if ( isset(…Continue reading

Attach a static file

add_filter(‘frm_notification_attachment’, ‘add_my_attachment’, 10, 3); function add_my_attachment($attachments, $form, $args){ //$args[‘entry’] includes the entry object if ( $args[’email_key’] == 1277 ) { //change 1277 to the ID of your email notification $attachments[] = ABSPATH . ‘/’.’wp-content/uploads/2015/02/filename.pdf’; //set the ABSOLUTE path to the…Continue reading

Remove automatic attachment

add_filter(‘frm_notification_attachment’, ‘remove_my_attachment’, 10, 3); function remove_my_attachment($attachments, $form, $args) { if ( $args[’email_key’] == 1277 ) { //change 1277 to the email ID that you would like to DROP the attachment for $attachments = array(); //remove all attachments } return $attachments;…Continue reading

Automatically update a field in another form

add_action(‘frm_after_create_entry’, ‘link_fields’, 30, 2); add_action(‘frm_after_update_entry’, ‘link_fields’, 10, 2); function link_fields($entry_id, $form_id){ if($form_id == 113){//Change 113 to the ID of the first form global $wpdb; $first_field = $_POST[‘item_meta’][25]; //change 25 to the ID of the field in your first form $user…Continue reading

Change a user’s role

add_action(‘frm_after_update_entry’, ‘update_user_role’, 10, 2); function update_user_role($entry_id, $form_id){ if ( $form_id == 41 ) { $userid = $_POST[‘item_meta’][1775];// 1775 is the ID of the userID field $role = $_POST[‘item_meta’][1134];// 1134 is the ID of the role dropdown if ( $userid &&…Continue reading

Basic Example

add_action(‘frm_before_destroy_entry’, ‘my_custom_function’); function my_custom_function($entry_id) { $entry = FrmEntry::getOne($entry_id); if ( $entry->form_id == 5 ) { // change 5 to your form id // do something for entries deleted from this form } }Continue reading

Delete Uploads

<script src=”https://gist.github.com/fb60fc55adb212cb0dd8.js?file=frm_delete_files.php” type=”text/javascript”></script>Continue reading

Separate child entries

add_action( ‘frm_before_destroy_entry’, ‘my_custom_function’, 9 ); function my_custom_function( $entry_id ) { $entry = FrmEntry::getOne( $entry_id ); if ( in_array( $entry->form_id, array( 5, 6, 7 ) ) ) { // change 5, 6, and 7 to your form ids global $wpdb; $table…Continue reading

Delete user

add_action(‘frm_before_destroy_entry’, ‘delete_user_with_entry’); function delete_user_with_entry( $entry_id ) { $form_id = 10;// Replace 10 with the ID of your form $field_id = 25;//Replace 25 with the ID of your userID field $entry = FrmEntry::getOne( $entry_id, true ); if ( $entry->form_id == $form_id…Continue reading