Skip to content

Instantly share code, notes, and snippets.

@zackkatz
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zackkatz/3ef09b9a0878d2551d66 to your computer and use it in GitHub Desktop.
Save zackkatz/3ef09b9a0878d2551d66 to your computer and use it in GitHub Desktop.
Modify the message shown after successfully editing an entry in GravityView
<?php
/**
* Code example for GravityView ( https://gravityview.co )
*
* Add the following code to the end of your theme's functions.php file.
*
* Make sure it's inside the ?> if ?> is at the end of the file!!!
*
*/
// 10 is the default priority to run a filter.
// 3 is the number of arguments passed to the function, in this case: $message, $view_id, $entry
add_filter( 'gravityview/edit_entry/success', 'my_gv_edit_entry_success_message', 10, 3 );
/**
* Modify the message shown after successfully editing an entry in GravityView
*
* @param string $message The existing message
* @param int $view_id The ID of the current view
* @param array $entry Graivty Forms entry array
*/
function my_gv_edit_entry_success_message( $message, $view_id, $entry ) {
// Option 1: Check for a single View ID
if ( intval( $view_id ) === 53 ) {
return 'My new success message!';
}
// Option 2: Check against a few View IDs
if ( in_array( $view_id, array( 53, 38, 37, 48 ) ) ) {
return 'A different new success message!';
}
// If the View ID doesn't match, return the original message
return $message;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment