IP v4 vs. v6 issue with idevaffiliate

Hey there,
i use idevaffiliate with s2member (as recommended). But i have some serious problems with IPv6 addresses.

idevaffiliate uses the IP address to save a connection to a recruiter. When a user clicks an affiliate link the ip address is saved in idevaffiliate and associated to the link owner. When this user pays for a subscription at my website a notification is sent to idevaffiliate with the ip address and idevaffiliate creates a commission for the recruiter/link owner.

The problem is: When the user has an IPv6 address, idevaffiliate saves this address. s2member in contrast saves the IPv4. Of course this IPs are not matching and no commission is created when the user has an IPv6 address.

Very bad. Is there anything i can do?

Interesting observation. I was just about to do a big push on the affiliate side of things - would be good to know if this could be addressed @jaswrks?

Appreciate it! :slight_smile:

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']

1 Like

First of all: Thanks for the comprehensive answer!

In my case the iDev is installed in the wordpress root on the same server as s2member. Because of that i was very surprised facing an issue like that. Strange isn’t it? Did you ever heard of IP missmatching issues between s2member and iDev running on the same server?

I try to find the IPv6 in the server variables you mentioned. In addition to that i contact my hosting provider (strato.de BTW) and ask for possible solutions. Maybe disabling IPv6 could be a solution even not for ever…
And i also contacted the iDev support. Maybe they can tell me where they get the IP address from…

I let you know when i know more.

Thanks for the explanation Jason! Thankfully, I don’t have this issue on my server. Hope you’re well mate! :+1::grinning::+1:

I think I have the same problem with WebinarJam. The IPv6 is not tracked and no commissions too.
There is 20% of my Trafic log in IPv6 instead of 80% in IPv4.
So this is a big matter…

If you finded the solution please write it down :slight_smile: