Doing a bit too much there.
Just for quick example sake, since I don’t know offhand what global potentially provides the X-Real-IP header you’re wanting:
function advantechmsp_ip_address( $ip_address ) {
return $_SERVER['X-Real-IP'];
}
add_filter( '_bprwg_ip_address', 'advantechmsp_ip_address' );
All you need to do for this.
the $ip_address
variable will hold the original value we intend to save, provided by $_SERVER['REMOTE_ADDR']
. However, you can return something completely different and THAT value will be saved instead. You could return “Pennywise’s Home” and that would end up being saved as the user meta. Sorry, watched Chapter 2 tonight :D.
So, back on topic, whatever provides the IP you’re intending to use, is what should be returned.
That said, since we only use the IP address for some rudimentary location indication, during the moderation process, and delete the saved value after they’ve been approved, not sure how useful this is actually going to be to you. We added the deletion of the meta for GDPR purposes.