Legal
diff --git a/htdocs/wp-content/themes/lawcarta/functions.php b/htdocs/wp-content/themes/lawcarta/functions.php
index acc5e04..9dd5922 100644
--- a/htdocs/wp-content/themes/lawcarta/functions.php
+++ b/htdocs/wp-content/themes/lawcarta/functions.php
@@ -396,4 +396,42 @@ function old_post_url_redirect(){
wp_redirect( home_url( $parts[3] ), 301 );
}
}
-add_action( "template_redirect", "old_post_url_redirect" );
\ No newline at end of file
+add_action( "template_redirect", "old_post_url_redirect" );
+
+/**
+ * Add custom validation for CF7 form fields
+ */
+function is_business_email($email){
+ if(
+ preg_match('/@gmail.com/i', $email) ||
+ preg_match('/@hotmail.com/i', $email) ||
+ preg_match('/@outlook.com/i', $email) ||
+ preg_match('/@yahoo.com/i', $email) ||
+ preg_match('/@protonmail.com/i', $email) ||
+ preg_match('/@icloud.com/i', $email) ||
+ preg_match('/@me.com/i', $email) ||
+ preg_match('/@aol.com/i', $email) ||
+ preg_match('/@mail.com/i', $email) ||
+ preg_match('/@tutanota.com/i', $email) ||
+ preg_match('/@tuta.com/i', $email) ||
+ preg_match('/@live.com/i', $email) ||
+ preg_match('/@msn.com/i', $email) ||
+ preg_match('/@inbox.com/i', $email)
+ ){
+ return false; // It's a publicly available email address
+ }else{
+ return true; // It's probably a company email address
+ }
+}
+function custom_email_company_validation_filter( $result, $tag ) {
+ if ( 'company-email' == $tag->name ) {
+ $the_value = isset( $_POST['company-email'] ) ? trim( $_POST['company-email'] ) : '';
+ if (!is_business_email($the_value)) {
+ $result->invalidate($tag, "This form only accepts business emails. Please provide your work address.");
+ }
+ }
+
+ return $result;
+}
+
+add_filter( 'wpcf7_validate_email*', 'custom_email_company_validation_filter', 20, 2 );
\ No newline at end of file
diff --git a/htdocs/wp-content/themes/lawcarta/header.php b/htdocs/wp-content/themes/lawcarta/header.php
index ef4b39a..1402e75 100644
--- a/htdocs/wp-content/themes/lawcarta/header.php
+++ b/htdocs/wp-content/themes/lawcarta/header.php
@@ -15,9 +15,14 @@ $scripts = [];
+
+
+
+
+
@@ -145,44 +150,10 @@ height="0" width="0" style="display:none;visibility:hidden">