Unapproving entries automatically after they're edited
When allowing logged-in users to edit entries they created by checking the "Allow User Edit" box in View Settings, you also have the option to automatically unapprove entries after they've been edited:
By default, only edits made by non-administrators will reset the approval status to "Unapproved."
If you would prefer to have the status reset to "Unapproved" when any user or administrator edits an entry, you can do that by adding the following code to your website:
/** * Unapprove entries after editing in GravityView, even if the user is an administrator * * @param array $form The Gravity Forms form being updated * @param string $entry_id The entry ID of the entry being updated */ add_action( 'gravityview/edit_entry/after_update', function( $form, $entry_id ) { gform_update_meta( $entry_id, 'is_approved', GravityView_Entry_Approval_Status::UNAPPROVED, $form['id'] ); }, 10, 2 );
Read here how to add these code samples to your website: Where to put code samples.
Advanced information about the Unapprove Entries After Edit functionality:
GravityView's auto-unapprove feature is only called if all of these conditions are met:
- The user is editing from the frontend (specifically via the gravityview/edit_entry/after_update action)
- With the "Unapprove Entries After Edit " feature enabled for the View
- The user is not an administrator (they do not have
gravityview_moderate_entries
capability) - The
gravityview/approve_entries/autounapprove/status
filter is not set anywhere tofalse