functions.php: update cookie policy and spam registration check

This commit is contained in:
Silvan Calarco 2024-01-28 11:44:54 +01:00
parent 93046350eb
commit 901183399f

View File

@ -367,7 +367,15 @@ function hook_cookielaw()
{ {
$outputlang = get_bloginfo("language"); $outputlang = get_bloginfo("language");
$outputlang = substr($outputlang,0,2); $outputlang = substr($outputlang,0,2);
$message = __("This website uses cookies to improve user experience.","responsive"); //$message = __("This website only uses first party technical cookies necessary for the correct functioning of it.","responsive");
if ("$outputlang" == "it") {
$message = "Questo sito usa esclusivamente cookie di prima parte di tipo tecnico necessari per il corretto funzionamento dello stesso.";
$policyurl = "/" . $outputlang . "/info/policy/";
} else {
$message = "This website only uses first party technical cookies necessary for the correct functioning of it.";
$policyurl = "/" . $outputlang . "/about/policy/";
}
$accepttext = __("I Understand","responsive"); $accepttext = __("I Understand","responsive");
$policytext = __("Cookie policy","responsive"); $policytext = __("Cookie policy","responsive");
$policyurl = "/" . $outputlang . "/info/policy/"; $policyurl = "/" . $outputlang . "/info/policy/";
@ -438,13 +446,19 @@ function user_registration_filter($user_id, $email) {
$e1 = explode("@", $email); $e1 = explode("@", $email);
if (in_array($e1[1], array( if (in_array($e1[1], array(
'xtra.ltd','tmobile.agency','btee.online','verizonconnect.online', 'xtra.ltd','tmobile.agency','btee.online','verizonconnect.online',
'eduonline.digital','vofadonepro.online'))) { 'eduonline.digital','vofadonepro.online','tasktracker.in'))) {
error_log( "user_registration_filter: email=" . $email . " blacklisted domain=" . $e1[1] ); error_log( "user_registration_filter: email=" . $email . " blacklisted domain=" . $e1[1] );
$user_id = 100; $user_id = 100;
} else {
//preg_match("/[0-9]{2}$/", $e1[0]) ||
if (preg_match("/[0-9]{3}$/", $e1[0]) || in_array($e1[0], array('astro_yoga'))) {
error_log( "user_registration_filter: email=" . $email . " blacklisted ([0-9]{2}$) domain=" . $e1[1] );
$user_id = 100;
} else { } else {
error_log( "user_registration_filter: email=" . $email . " whitelisted domain=" . $e1[1] ); error_log( "user_registration_filter: email=" . $email . " whitelisted domain=" . $e1[1] );
} }
} }
}
return $user_id; return $user_id;
} }
add_filter('email_exists', 'user_registration_filter', 10, 2); add_filter('email_exists', 'user_registration_filter', 10, 2);