• Resolved ambern

    (@ambern)


    Hi there,
    I’m looking for a way to block a specific malware link that’s being sent via our contact form using the free version of WPForms. We’ve now receive two emails from fake addresses claiming photo copyright infringement containing a link to “firebasestorage.googleapis.com” (I won’t include the rest of it) that’s known to download trojans and malware onto your computer. We have reCaptcha turned on and I’ve just turned on anti-spam protection on all of the forms. Because this has been getting through reCaptcha, I’m wondering if it’s possible to block the specific link that’s being sent?

    Thanks!

    • This topic was modified 3 years, 3 months ago by ambern. Reason: mispelled word

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Kenneth Macharia

    (@kmacharia)

    Hi @ambern

    We don’t currently have a way to block URLs within the form builder but this can be achieved using the code snippet I’ve shared below:

    /*
     * Block the firebasestorage.googleapis.com url on Single Line Text and Paragraph Text form fields
     *
     * @link https://wpforms.com/developers/how-to-block-urls-inside-the-form-fields/
    */
      
    function wpf_dev_check_for_urls( $field_id, $field_submit, $form_data ) {
     
        if( strpos($field_submit, 'firebasestorage.googleapis.com') !== false ) {
            wpforms()->process->errors[ $form_data['id'] ][ $field_id ] = esc_html__( 'This URL is not allowed.', 'wpforms' );
            return;
        } 
         
    }
       
    add_action( 'wpforms_process_validate_textarea', 'wpf_dev_check_for_urls', 10, 3 );
    add_action( 'wpforms_process_validate_text', 'wpf_dev_check_for_urls', 10, 3 );

    In case it helps, here’s our tutorial with the most common ways to add custom code like this.

    For the most beginner-friendly option in that tutorial, I’d recommend using the Code Snippets plugin.

    Thread Starter ambern

    (@ambern)

    Hey @kmacharia, thank you! I use the code snippets plugin (I’m front-end but I guess we’re all expected to be able to do everything these days) using the common portion in the malware links that’s being sent. That’s a great little plugin, very handy! Thanks for your time and attention to the matter. I’ll follow up if anything strange occurs.
    ??

    Plugin Support Kenneth Macharia

    (@kmacharia)

    Hey @ambern

    Sounds good! Let us know if anything else comes up. ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Block Malware link?’ is closed to new replies.