• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Global Variable for IP Addresses?

James

Well-known member
#1
I'm not sure if I've missed it or if it doesn't exist, but I've been looking for a variable for the current user's IP address ($bbuserinfo equivalent for vBulletin (ex-)customers), and can't find it anywhere.

Does anyone know if this exists and what it is?
 

Mike

XenForo developer
Staff member
#2
That's just in the server array ($_SERVER['REMOTE_ADDR']). It's not something we ever expose to the templates though.
 

James

Well-known member
#3
So I should just call the variable via the standard $_SERVER['REMOTE_ADDR'] approach instead of a {$user.ip} approach?

EDIT: Never mind, tried $_SERVER['REMOTE_ADDR'], {$ipInfo.confirmationIp}, {$ipInfo.registrationIp} and {$ipInfo.contentIp}.

I'm going to try to {xen:set} an IP variable now... or is it possible to map the IP variable? I'll get to work on this tomorrow.
 

James

Well-known member
#5
Ah, of course! The only reason it didn't work last time is because I temporarily forgot that arrays use the period instead of the usual [' '].

Thanks Mike :)