• Resolved Ralph

    (@ralph001)


    Hi team,

    I am contemplating switching to forminator on all my websites but I have a security issue that I want to clarify first.

    When I create a text field (not rich text) I want the text to be stripped of any code. A good example is a contact us form with a message field, if I add any type of code in the message field, the text should be stripped of all code and converted to plain text.

    is this possible?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Zafer – WPMU DEV Support

    (@wpmudevsupport15)

    Hi @ralph001,

    I hope you are doing well today!

    This issue has been flagged to our SLS (Second Line Support) Team so that they can dig into this further. We will post an update here as soon as more information is available.

    Thank you for your patience while we look into this further.

    Kind regards,
    Zafer

    Plugin Support Zafer – WPMU DEV Support

    (@wpmudevsupport15)

    Hi again @ralph001,

    Please try the following code snippet as mu-plugin and change 361 with your form ID.

    You can find more information below on how to use mu-plugins.
    https://wpmudev.com/docs/using-wordpress/installing-wordpress-plugins/#installing-mu-plugins

    <?php
    add_filter( 'forminator_prepared_data', 'wpmudev_strip_textarea_html', 10, 2 );
    function wpmudev_strip_textarea_html( $prepared_data, $module_object ){
        if( $module_object->id != 361 ){ //Please change form ID
            return $prepared_data;
        }
    
        foreach( $prepared_data as $key => $value ){
            if(    strpos( $key, 'text' ) !== false ){
                if( $value ){
                    $prepared_data[ $key ] = strip_tags( $value );
                }
            }
        }
    
        return $prepared_data;
    }

    Kind regards,
    Zafer

    Thread Starter Ralph

    (@ralph001)

    Hi team,

    thank you for the prompt reply, I shall test this and will let you know if it works.

    Regards,
    Ralph

    Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    Hello @ralph001 ,

    We haven’t heard from you for a week now, so it looks like you don’t have any more questions for us.

    Feel free to re-open this ticket if
    needed.

    Kind regards
    Kasia

    Thread Starter Ralph

    (@ralph001)

    I tested the code and So far it’s working fine, Thank you!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Code in text fields’ is closed to new replies.