There are many great code snippets in their Gitlab. You might find more on their…
Forminator Forms are not yet Compatible with Internet Explorer IE11 – Show a Message instead!
I know, no one wants to use IE11 and no one talks about it anymore but it is out there and a client recently asked to fix some bugs with modern plugins in this old browser.
The page we were working on does heavily rely on Forminator plugin from WPMUDEV. I really think this is one of the best form plugins out there but it crashes on IE 11 and creates Script errors that will kill any other sripts running on the same site.
To not make things worse I searched for a solution to totally disable the Forminator shortcode on IE platforms. here is what I got.
Disabling the Forminator Shortcode
Disabling the forminator shortcode requires to hack a core file of the plugin. But until there is an official solution this is rather ok for me and at least better than script errors on the page. So I can display a message and ask the guest to send a mail instead.
Open up this file:
/wp-content/plugins/forminator/library/modules/custom-forms/front/front-render.php
Find a function named „render_shortcode“ aroud lne 392 and insert in the beginning right after the opening „{“ the following highlighted code so that the beginning of the function loooks like this:
/** * Render shortcode * * @since 1.0 * * @param array $atts * * @return string */ public function render_shortcode( $atts = array() ) { //enym IE11 if (preg_match('~MSIE|Internet Explorer~i', $_SERVER['HTTP_USER_AGENT']) || (strpos($_SERVER['HTTP_USER_AGENT'], 'Trident/7.0; rv:11.0') !== false)) { return '<p>Unfortunately the form cannot be displayed on such an old browser. Please send us a mail instead: <a href="mailto:info@example.com">info@example.com</a></p>'; exit(); } //enym IE11
This link guided me into the right directeion: https://gist.github.com/douglascabral/6ee44fc02218936d32741f7c7f7f157e
Dieser Beitrag hat 0 Kommentare