[Contact Widget] PHP 7.2 Compatibility

Hello,

I am preparing our WordPress Multisite install with a transition to PHP 7.2. I've ran a PHP Compatibility check on all our code. The results indicated that there are a set of errors with the ReCaptcha library the plugin uses ( see below ).

Is there any plans on updating this part of the plugin to be compatible with PHP 7.2?

FILE: ./contact-form/scripts/recaptchalib.php


FOUND 4 ERRORS AND 1 WARNING AFFECTING 4 LINES


59 | WARNING | Use of deprecated PHP4 style class constructor is not supported since PHP 7.

261 | ERROR | The constant "MCRYPT_MODE_CBC" is deprecated since PHP 7.1 and removed since PHP 7.2

262 | ERROR | The constant "MCRYPT_RIJNDAEL_128" is deprecated since PHP 7.1 and removed since PHP 7.2

265 | ERROR | Function mcrypt_encrypt() is deprecated since PHP 7.1 and removed since PHP 7.2; Use OpenSSL instead

265 | ERROR | Extension 'mcrypt' is deprecated since PHP 7.1 and removed since PHP 7.2; Use openssl (preferred) or pecl/mcrypt once available instead


  • Nithin
    • Support Wizard

    Hi JJ,

    I’m afraid, there hasn’t been any further development regarding the Contact Widget plugin as it was removed from the WPMU DEV Dashboard plugin list.

    Did you check Forminator plugin? It should help with adding Widgets and creating custom forms, could you please check, and see whether Forminator plugin covers your requirement?

    https://premium.wpmudev.org/docs/wpmu-dev-plugins/forminator/

    In the meanwhile, I’m checking with our team to see whether there is any patch regarding the PHP compatibility issue noticed with Contact Widget plugin and will get back to you once we have further feedback asap.

    Regards,

    Nithin

  • JJ
    • Flash Drive

    Hi Nithin,

    Thanks for your reply. I did take a look at that plugin but since I’m running a multisite I would have to create a new form on each site and I really need the captcha feature as well. I look forward to perhaps hearing back from the dev team about a patch.

  • Tho Bui
    • Staff

    Hello JJ,

    I checked and see we can fix this case by going to Appearance->Widgets, in Contact Form you can switch ReCaptcha Version to New. I tested with php 7.2 and 7.3, it’s working fine for me.

    But looks you have a lot of subsites. In that case, I prepared a custom snipped code:

    add_filter( 'option_widget_contact_form', function($widget_configs){
    if( $widget_configs ){
    foreach( $widget_configs as $k => $configs ){
    if( is_array( $configs ) && isset( $configs['contact_form_recaptcha_version'] ) ){
    $widget_configs[ $k ]['contact_form_recaptcha_version'] = 'new';
    break;
    }
    }
    }
    return $widget_configs;
    });

    All you need to do is copy and paste this into your child theme’s functions.php file. Or you can paste to a new php file and use this as a MU plugin (remember add open tag in the new php file <?php).

    If you are not familiar with mu-plugins you can read about them here:

    https://premium.wpmudev.org/manuals/wpmu-manual-2/using-mu-plugins/

    Kind Regards,

    Tho Bui

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.