Hi,
I know, this topic is not new, but the php script to change from html to text notifications does not work for me. There is a message: Cannot redeclare function change_notification_format.
What’s the problem?
add_filter( 'gform_notification', 'change_notification_format', 10, 3 );
function change_notification_format( $notification, $form, $entry ) {
GFCommon::log_debug( 'gform_notification: change_notification_format() running.' );
// Do the thing only for a notification with the name Text Notification
if ( $notification['name'] == 'Text Notification' ) {
GFCommon::log_debug( 'gform_notification: format changed to text.' );
// Change notification format to text from the default html
$notification['message_format'] = 'text';
}
return $notification;
}
One more question:
I only want to change notifications with a name containing “text”. Could this work?
if (str_contains($notification['name'], 'text') !== false) {
Thanks!
Niko