Skip to content

Instantly share code, notes, and snippets.

@mishterk
Created January 25, 2024 23:40
Show Gist options
  • Save mishterk/33d089ca5e299146f88471768a711df6 to your computer and use it in GitHub Desktop.
Save mishterk/33d089ca5e299146f88471768a711df6 to your computer and use it in GitHub Desktop.
<?php
add_action( 'af/form/submission', function ( $form, $args ) {
// Append a custom value to the submission array
AF()->submission['some_extra_data'] = 'some value here';
}, 10, 2 );
add_filter( 'af/form/success_message', function ( $success_message, $form, $args ) {
// Use the custom value to determine the success message
if ( AF()->submission['some_extra_data'] === 'some value here' ) {
$success_message = 'This is a custom success message';
}
return $success_message;
}, 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment