Form Visible Custom Text Message
-
Thanks for making a great plugin.
I am able to hide the form from appearing using the following hook:
apply_filters( 'forminator_cform_form_is_visible', $can_show, $this->id, $form_settings );Is it possible to have the message that appears associated with hiding the form also be programmatically set?
For instance, if I add a filter to the above filter that checks to see if the user already submitted the form once, thereby hiding the form if they already submitted once, is there a way to make the message that appears in place of the form say something like, “sorry you have already submitted the form once” via another filter condition?
-
I hope you are doing good today.
I pinged our SLS and Forminator Team what will be possible in this case. We will post an update here as soon as more information is available.
Kind Regards,
KrisHi, @wpmudevsupport13 , I’m providing additional information that may help the developers with this situation.
I specifically reviewed the lines of codes in the
forminator\library\modules\custom-forms\front\front-render.phpfile, and it would be good if the following lines had a filter associated with them – having the$messagevariable be associated with a filter to allow for filtering the message would be useful:$message = $form_settings['expire_message']; ?> <label class="forminator-label--info"><span><?php echo esc_html( $message ); ?></span></label>Appreciate the update @plantprogrammer
I pinged our devs once again, will keep you posted with any updates. 🙂
Thank you,
DimitrisHello there @plantprogrammer
Our devs provided a workaround for you, please check the snippet below:
<?php add_filter('forminator_cform_form_is_visible', function( $can_show, $form_id, $form_settings ){ $your_form_id = 123; if( $your_form_id === intval( $form_id ) ){ // your custom code here. $can_show = false; if( ! $can_show ){ add_filter('esc_html', 'wpmudev_forminator_custom_visible_message', 10, 2 ); } } return $can_show; }, 999, 3); function wpmudev_forminator_custom_visible_message( $safe_text, $text ){ if( $text === '[your_custom_message]' ){ // $safe_text = do_shortcode('[your_custom_message]');//Or $safe_text = 'Your custom message here!'; // It's not required but you can remove the filter if you don't reuse this form on one page. remove_filter('esc_html', 'wpmudev_forminator_custom_visible_message', 10, 2 ); } return $safe_text; }and these form Behaviour settings:
Warm regards,
Dimitris
The topic ‘Form Visible Custom Text Message’ is closed to new replies.