• Resolved Ian Sackofwits

    (@plantprogrammer)


    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?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Kris – WPMU DEV Support

    (@wpmudevsupport13)

    Hi @plantprogrammer

    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,
    Kris

    Thread Starter Ian Sackofwits

    (@plantprogrammer)

    Hi, @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.php file, and it would be good if the following lines had a filter associated with them – having the $message variable 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>
    Plugin Support Dimitris – WPMU DEV Support

    (@wpmudev-support6)

    Appreciate the update @plantprogrammer

    I pinged our devs once again, will keep you posted with any updates. ??

    Thank you,
    Dimitris

    Plugin Support Dimitris – WPMU DEV Support

    (@wpmudev-support6)

    Hello 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:

    flameshot_screenshot

    Warm regards,
    Dimitris

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Form Visible Custom Text Message’ is closed to new replies.