Form success_msg not updated on frm_success_filter

By: Jordi Valls | Asked: 01/18/2024
ForumsCategory: Code HelpForm success_msg not updated on frm_success_filter
Jordi Valls asked 3 months ago

Based on the free plugin I have created a function that dynamically changes the content of the confirmation message $form->options['success_msg'] through the frm_success_filter hook. This works in my development environment with the free plugin. But when uploading it to the production environment, where the pro version is installed, the message is not changed. The code is something like:

add_filter('frm_success_filter', 'my_custom_function', 10, 2);
function my_custom_function($type, $form) {
    	$type = 'message';
    	$form->options['success_msg'] = "My custom message";

	// In the print of $form the content of success_msg appears changed to "My custom message"
	print_r($form);

	return $type;
} 

But the output on the confirmation page is the default message.   Anyone can help?
Thanks in advance

1 Answers
Jordi Valls answered 3 months ago
I solved the problem by removing:
return $type;
And the modifyed message is displayed. I have developed my code from samples at https://formidableforms.com/knowledgebase/frm_success_filter/ include . It seems that all the examples on this page are wrong because they all include "return $type"

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right