All Users Same IP

Hi there,

All of our members signing up are showing the same IP address (our servers IP). Is there something I need to change to fix this?

I did find this thread but wasn’t sure if it is what we needed to do as we aren’t a cloud based setup.

http://www.primothemes.com/forums/viewtopic.php?t=6380&p=14618#p14618

Our server is a Intel Xeon E3-1270 CPU if that helps.

Just an update…we applied the fix in that thread and it now is passing no IP address through for the user to s2 or Stripe. Any ideas? I assume this will at least temporarily protect from brute force locking everyone out again from one users failed attempts

I can’t see any code on that thread, so I assume it’s been removed since you posted. And I therefore don’t know whether it looked anything like my attempt at trying to provide you with a filter to do the job. Anyway, here it is, albeit untested:

function register_real_ip( $fields ) {
    if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
        $fields['s2member_registration_ip'] = $_SERVER['HTTP_X_FORWARDED_FOR'];
    }
    return $fields;
}
add_filter( 'ws_plugin__s2member_ms_create_existing_user', 'register_real_ip' );
```
Note: just changed the hook, as the one I originally suggested doesn't take a filter but an action.

Awesome thanks. This is different. Just to clarify, which file are you putting this in?

Jason,

You could put this either in your (child) theme’s functions.php file or in the mu-plugins folder.

If you put it in the latter, you can include it in another file that’s already there or add it as its own file. If you keep it separate, you’ll need to give the file a name ending in .php and preface the code above with <?php

Thanks for helping out. I put the above code in the s2-hacks file and still giving me the server IP on every new member. Any thoughts?

Yes, try changing the last line to this:

add_filter( 'wp_login', 'register_real_ip' );

Actually, I think that should be:

add_action( 'wp_login', 'register_real_ip' );

Tried both with no luck :confused: Could it be a server setting that needs to be changed?

Perhaps, but I doubt it. I think the basic code here is probably right or close to it, but finding the right hook to run it is the problem. Let’s try a different approach, again just changing the last line:

add_action( 'set_user_role',  'register_real_ip' );

If that doesn’t work, could you explain how your users are registering. In other words, what form or button are they using, and do they use PayPal or Stripe?

It kicked back this error on the purchase page and still grabbed IP

Warning: Cannot use a scalar value as an array in

I have it set up with stripe pro forms

Hmm, I think that suggests this needs to be an s2Member hook, and not a WP hook. You probably need someone more expert in s2Member hooks than me, but maybe this will do the trick:

add_action( ws_plugin__s2member_during_configure_user_registration_front_side_paid, 'register_real_ip' );

Maybe it should be hooked to “init”, and code to be adapted to run only in registration time?

Hey, just updating we were able to figure this out and fix. This is the note from the server company:

I am happy to inform you that the problem has been successfully resolved with installation of mod_rpaf.

This fixed things right away. Thanks for both of your help :slight_smile: