Conditional Edit

Experimental Snippet 🧪

Create a field on your form and check for a specific value on that field to determine if the passed through entry should be edited or if a new entry should be created.

Read the Walkthrough

Code

Filename: gpepee-conditional-edit.php

<?php
/**
 * Gravity Perks // Easy Passthrough Edit Entry // Conditional Edit
 * https://gravitywiz.com/edit-gravity-forms-entries-on-the-front-end/
 *
 * Experimental Snippet 🧪
 *
 * Create a field on your form and check for a specific value on that field to determine if the passed
 * through entry should be edited or if a new entry should be created.
 */
// Update "123" to the form you are using to edit entries.
add_filter( 'gpepee_edit_entry_id_123', function( $update_entry_id, $form_id ) {
	// Update "4" to the field ID you want to check the value of.
	if ( rgpost( 'input_4' ) === 'Add New' ) {
		$update_entry_id = false;
	}
	return $update_entry_id;
}, 10, 2 );

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.