s2Member uses the standard environment variable provided by PHP/WordPress to collect the IP address, which is $_SERVER['REMOTE_ADDR']
. If that’s not a match to what your hosting platform collects on the site running iDev, then the two will not track commissions properly. A solution would be to adjust one or the other. In this case, you may want to consider using something like this in the WordPress wp-config.php
file, at the top.
if (!empty($_SERVER['HTTP_CF_CONNECTING_IP'])) {
$_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_CF_CONNECTING_IP'];
}
That would work for most sites using CloudFlare. But there are a number of other environment variables that commonly hold the IP address of the user. Deciding which one to use is sometimes difficult, and you may need to contact your hosting company for advice. It just depends on how your architecture is set up.
Other $_SERVER['']
vars commonly used to store the IP address.
$_SERVER['HTTP_CF_CONNECTING_IP']
$_SERVER['HTTP_CLIENT_IP']
$_SERVER['HTTP_X_FORWARDED_FOR']
$_SERVER['HTTP_X_FORWARDED']
$_SERVER['HTTP_X_CLUSTER_CLIENT_IP']
$_SERVER['HTTP_FORWARDED_FOR']
$_SERVER['HTTP_FORWARDED']
$_SERVER['HTTP_VIA']
$_SERVER['REMOTE_ADDR']
The standard being $_SERVER['REMOTE_ADDR']
, but on some hosting platforms this variable actually holds an incorrect value. That’s generally viewed as a bug in the hosting platform, but it’s rather easy to tweak, by just setting the environment variable to the correct value in your wp-config.php
file, thereby overriding the default value of $_SERVER['REMOTE_ADDR']