사용할 수있는 메일 태그가 있습니까? 예를 들어 ; 우리가 사용할 수있는 클라이언트의 IP를 추적하기 위해; [_remote_ip]어떻게 연락 담당자가 연락처 양식 7을 통해 양식을 제출 한 후 발신자 국가를 추적 할 수 있습니까?
-2
A
답변
0
첫 번째 단계는 API 키를 만드는 것입니다. 우리가 사이트에 등록해야만하는 API 키를 얻으려면 IPInfoDB.
API 키가 준비되면 우리는 IPInfoDB 사이트에서 ip2locationlite.class.php 파일을 다운로드해야합니다.
다음 단계는 맞춤 플러그인을 만드는 것입니다. 이름을 'country_custom_plugin.php'로 지정했습니다. 폴더 내에서 커스텀 플러그인을 생성하는 것이 항상 좋기 때문에 해당 플러그인에 필요한 모든 파일이 폴더에 남아있게됩니다. 폴더를 "country_custom_plugin"으로 지정했습니다.
"ip2locationlite.class.php"파일을 "country_custom_plugin"폴더로 이동하십시오.
/* 접촉 형 -7- 모듈의 함수를 호출 함수 stylus_ip_location_get_cc이 도움이 될
add_filter('wpcf7_special_mail_tags', 'country_custom_ip_location', 10, 2);
/*Function to get location of an user from the ip address*/
function country_custom_ip_location($output, $name){
/*including the third party integration to get IP Location*/
include_once('ip2locationlite.class.php');
/*Special tag values are passed in format wpcf7.$name which we convert to _$name*/
$name = preg_replace('/^wpcf7\./', '_', $name);
/*If location is requested in contact form enter the loop*/
if ('_custom_ip_location' == $name) {
$ipLite = new ip2location_lite;
/*Entering the API key value generated*/
$ipLite->setKey('"Enter your API Key Here"');
/*Getting the IP address*/
$ipaddress = preg_replace('/[^0-9a-f.:, ]/', '', $_SERVER['REMOTE_ADDR']);
/*Getting the Location*/
$visitorGeolocation = $ipLite->getCity($ipaddress);
if (!empty($visitorGeolocation) && is_array($visitorGeolocation)) {
$output = $visitorGeolocation['regionName'] . ', ' . $visitorGeolocation['countryName'] . ', ' . $visitorGeolocation['countryCode'];
}
}
return $output;
}
Reference .Hope */
결과를 전달. 문제가 있으면 알려주십시오.