MyBB Community Forums

Full Version: How do I prompt a user's/guest's IP?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi,
I want to take @T-K's edit to the next level (for me) and to prompt a user's/guest's IP info via a site using @Labrocca's "My Side Boxes" plugin. But, if I use {$lang->ip} {$user['ip']}, I don't see anything - not the word "IP address" and not the IP itself. The box is on the index (if that changes anything).

Edit: Just did @Gene53's edit and I don't get the IP either. b.t.w., if you didn't understand, in @T-K's edit I do see the IP.



Ori...
Do you just want to show the current user's IP (i.e., the user who's viewing the page) or what?
Yes Dennis (for the first part of your question). The problem is that it works fine (I see the address) in the "Who's Online" in @T-K's plugin but not on the index (inside a box using "My Side Boxes" plugin nor in @Gene53's plugin).
If you'll go to my forum: http://www.ithelp.co.il/forum (yes, it's in Hebrew), look at the top most box (on the left, the one that has the word "IP" in it).
You should see an IP after the text line and if you'll look at the address the flag shows (when hovering or clicking on it), it's missing the IP address. My box's code is
<table border="0"  cellspacing="1" cellpadding="4" class="tborder">
	<tr>
		<td class="thead"><strong>מידע על ה-IP שלך</strong></td>
	</tr>
	<tr>
		<td class="trow1">
			כתובת ה-IP שלך היא: <strong>{$user['ip']}</strong><br />
			<A HREF="http://www.ip-adress.com/ip_tracer/{$user['ip']}" target="_blank">
				<IMG SRC="http://api.hostip.info/flag.php?ip={$user['ip']}" ALT="חיפוש/מידע על כתובת ה-IP"></A>
		</td>
	</tr>
</table>
<br />
I believe this should get the IP in both places. Isn't it?
Please help. I realy do want this to work (without the need for a plugin, if possible)
Try $mybb->user['ip'] instead of $user - chances are the $user variable isn't used in the plugin.
Sorry, but no joy here. Now what I see in the place of the IP is: Array['ip'] .
Ahhh poo... of course it won't display anything because there is no "ip" field in the database! My mistake...

Try $session->ipaddress.
I wish it worked... Maybe it's something to do with the "My Side Boxes" plugin (it's @labrocca's with some, small, edits by me - oked by @labrocca). I tried with "{}" and without ones.
Ah... I don't have that plugin, so I can't test it out, but I'm pretty sure it will work if you define it in the global scope.

Find the function that hooks into the page, and you'll see something like this:

global $db, $lang, $mybb;

Just add $session into this list and you should be OK...
Will I have to disable and enable the plugin to get this edit to work?

Edit 1: nvm, found that I don't. Thanks, "joy, very joy indeed". It works now
Edit 2: If we're on the subject of showing an IP addr. (this is do to a mod someone - forgot who - published and then removed) If I add a "{$mybb->user['ip])" to the 'member_profile_modoptions' template, will it show my IP (I'm the admin/moderator) as I look on a user's UserCP or the user's "Last known IP address"?
Pages: 1 2