[Solved] Would it be easy to add the user's From_IP_Address to the Banned Information message?

Need some custom code changes to the phpBB core simple enough that you feel doesn't require an extension? Then post your request here so that community members can provide some assistance.

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
SQLnovice
Registered User
Posts: 134
Joined: Thu Oct 10, 2019 5:03 am

[Solved] Would it be easy to add the user's From_IP_Address to the Banned Information message?

Post by SQLnovice »

I'm trying to save additional interaction steps with non-technical forum users, which is all of our forum users, when troubleshooting banned IPs. Each resolution usually takes several days just to find out the IP address they could have provided to us in the first place. Instead it only tells them their IP is banned, but not what that IP address is. :roll:
You have been permanently banned from this board

Please contact the Board Administrator for more information

A ban has been issued on your IP address
I'd like to show it after the third line. For example, it would appear as
A ban has been issued on your IP address
113.16.240.10'


The Contact Us page embeds the From_IP_Address code to accomplish the same thing,

Code: Select all

IP Address: {FROM_IP_ADDRESS}
so if I just knew where to add it in the ban page...?

And if so, we could alter the second row's contact board administrator line as follows.
You have been permanently banned from this board

Please provide the following IP ban information when contacting the Board Administrator

A ban has been issued on your IP address
113.16.240.10
Last edited by Mick on Tue Aug 27, 2024 7:38 am, edited 4 times in total.
Reason: Solved.
User avatar
KevC
Support Team Member
Support Team Member
Posts: 72560
Joined: Fri Jun 04, 2004 10:44 am
Location: Oxford, UK

Re: Would it be easy to add the user's From_IP_Address to the Banned Information message?

Post by KevC »

Just a thought, wouldn't that then give away to them the IP that has been banned and they'll then know that a simple router reboot or a VPN will bypass it with ease.

And a second point, IP banning is largely useless for the reason I've pointed out.
-:|:- Support Request Template -:|:-
Image
"Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb"
SQLnovice
Registered User
Posts: 134
Joined: Thu Oct 10, 2019 5:03 am

Re: Would it be easy to add the user's From_IP_Address to the Banned Information message?

Post by SQLnovice »

But which forum file or files would I need to make that change??? That's the question and the whole reason why I'm asking it here on the PHPBB forum.

Showing a user their IP isn't something they can't find elsewhere anyways, they could simply have another browser tab open with that information in hand.

Hoping someone with PHPBB knowledge can help. :D
User avatar
danieltj
Infrastructure Team Member
Infrastructure Team Member
Posts: 518
Joined: Thu May 03, 2018 9:32 pm
Location: United Kingdom
Name: Daniel James

Re: Would it be easy to add the user's From_IP_Address to the Banned Information message?

Post by danieltj »

I’ve moved this to custom coding because you’re not asking for support for vanilla phpBB installs. You’d likely need to modify the core files (which we don’t advise) unless there’s some template events you can hook into. Someone might be able to help you.
💷 Purchase the Awesome Payments extension today!
Monetise your forum with one off payments and subscriptions.

Need a premium extension created? Send me a PM.
User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 6290
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.

Re: Would it be easy to add the user's From_IP_Address to the Banned Information message?

Post by thecoalman »

Generally speaking custom coding advice is for simple one off edits. What you are trying to do would probably require a column in a table somewhere and updating it. It's not very simple.

To touch on what KevC said IP bans are not very useful and if you are having to go back so often to lift them you probably should reconsider how you are using them. IP's change and most people know they can unplug their modem for short time to get a new one. The next person that gets that IP might be another user of your forum. IP's are not always single machines either, they could be an entire college campus as one example. Where IP bans are useful is for short term bans with specific case. e.g. a banned user comes back and registers new account repeatedly. In that case ban the IP for a few days and hope they don't know about changing their IP.

That said the file and lines you are looking for are around line 1306 in /phpbb/session.php
“Results! Why, man, I have gotten a lot of results! I have found several thousand things that won’t work.”

Attributed - Thomas Edison
HB
Registered User
Posts: 230
Joined: Mon May 16, 2005 9:30 pm

Re: Would it be easy to add the user's From_IP_Address to the Banned Information message?

Post by HB »

thecoalman wrote: Sun Aug 25, 2024 12:06 amThat said the file and lines you are looking for are around line 1306 in /phpbb/session.php
Something like this, FIND:

Code: Select all

			$message .= ($ban_row['ban_give_reason']) ? '<br /><br />' . sprintf($this->lang['BOARD_BAN_REASON'], $ban_row['ban_give_reason']) : '';
			$message .= '<br /><br /><em>' . $this->lang['BAN_TRIGGERED_BY_' . strtoupper($ban_triggered_by)] . '</em>';
ADD:

Code: Select all

			if ($ban_triggered_by == 'ip') 
			{
				$message .= ' Your banned IP adddress is ' . $this->ip . '.';
			}
Note I did not test this at all.
Dan Kehn
User avatar
P_I
Community Team Member
Community Team Member
Posts: 2437
Joined: Tue Mar 01, 2011 8:35 pm
Location: Western Canada 🇨🇦

Re: Would it be easy to add the user's From_IP_Address to the Banned Information message?

Post by P_I »

SQLnovice wrote: Sat Aug 24, 2024 9:53 pm Showing a user their IP isn't something they can't find elsewhere anyways, they could simply have another browser tab open with that information in hand.
There are many websites such as https://whatismyipaddress.com/ that users can use to find their IP address.
Normal people… believe that if it ain’t broke, don’t fix it. Engineers believe that if it ain’t broke, it doesn’t have enough features yet. – Scott Adams
SQLnovice
Registered User
Posts: 134
Joined: Thu Oct 10, 2019 5:03 am

Re: Would it be easy to add the user's From_IP_Address to the Banned Information message?

Post by SQLnovice »

HB wrote: Sun Aug 25, 2024 2:07 pm
thecoalman wrote: Sun Aug 25, 2024 12:06 amThat said the file and lines you are looking for are around line 1306 in /phpbb/session.php
Something like this, FIND:

Code: Select all

			$message .= ($ban_row['ban_give_reason']) ? '<br /><br />' . sprintf($this->lang['BOARD_BAN_REASON'], $ban_row['ban_give_reason']) : '';
			$message .= '<br /><br /><em>' . $this->lang['BAN_TRIGGERED_BY_' . strtoupper($ban_triggered_by)] . '</em>';
ADD:

Code: Select all

			if ($ban_triggered_by == 'ip') 
			{
				$message .= ' Your banned IP adddress is ' . $this->ip . '.';
			}
Note I did not test this at all.
Boom! First try. 8-) It worked! Thank you! Thank you! You've saved us and our users so many needless wasted steps.

Using your code logic, I actually injected the message and IP info after the second $message line in session.php, this being the new lines 1303 - 1307:

Code: Select all

			if ($ban_triggered_by == 'ip') 
			{
				$message .= '..providing them your IP address ==> ' . $this->ip . '.';
			}
The result
Information
You have been permanently banned from this board.

Please contact the Board Administrator for more information...providing them your IP address ==> xxx.xxx.xxx.xxx.

A ban has been issued on your IP address.

Return to “phpBB Custom Coding”