Page 1 of 1

How to add a custom image to the ban message screen

Posted: Sat Apr 20, 2019 2:47 pm
by Miu
Hi, I'm wondering if anyone could tell me how to add an image below the message that shows up when someone has been banned from my forum. Is there an easy way to do this?

Re: How to add a custom image to the ban message screen

Posted: Sat Apr 20, 2019 2:56 pm
by stevemaury
What message that shows up where?

Re: How to add a custom image to the ban message screen

Posted: Sat Apr 20, 2019 3:04 pm
by Miu
I've attached a screenshot with an arrow pointing to where I mean. I just want to have an image displayed, but I'm not sure which files I need to edit to do so.

Image

Re: How to add a custom image to the ban message screen

Posted: Sat Apr 20, 2019 8:59 pm
by stevemaury
No way I can read that. Why don't you really attach it rather than embed it?

Re: How to add a custom image to the ban message screen

Posted: Sat Apr 20, 2019 9:07 pm
by 3Di
https://i.imgur.com/8QdhBLe.png

that could be probably done via an extension, see:

Code: Select all


		/**
		* Event to set custom ban type
		*
		* @event core.session_set_custom_ban
		* @var	bool		return				If $return is false this routine does not return on finding a banned user, it outputs a relevant message and stops execution
		* @var	bool		banned				Check if user already banned
		* @var	array|false	ban_row				Ban data
		* @var	string		ban_triggered_by	Method that caused ban, can be your custom method
		* @since 3.1.3-RC1
		*/
Not quite sure though, perhaps another event should be made to append the $message var.

Re: How to add a custom image to the ban message screen

Posted: Sun Apr 21, 2019 10:12 am
by Raul [ThE KuKa]
Nice style, but... :roll: HikiOta Style by William Moreland this is NOT true. :twisted:

This is the original style copyright: Flat Style by Ian Bradley

Re: How to add a custom image to the ban message screen

Posted: Sun Apr 21, 2019 3:38 pm
by Lumpy Burgertushie
just some helpful suggestions:

replace that collection of background images with just one image. your background takes forever to load.
and, nobody can see all those images behind the board anyway
and, you can add your name to the credits along with the original designer. for example:
HikiOta Style by William Moreland based on Flat Style by Ian Bradley

robert

Re: How to add a custom image to the ban message screen

Posted: Sun Apr 21, 2019 5:00 pm
by EA117
If you wanted to add an image which always shows on this "INFORMATION" message page, then the message_body.html template in the style is what can be modified. This would be if the additional image is "just for aesthetic purposes", and you want the additional image to display 100% of the time, regardless of whether the "INFORMATION" message being shown is in relation to banning or for some other reason.

If you did want the image to ONLY show when a banned user was being rejected, there isn't any template specific to that scenario, nor does there appear to be a template-testable condition defined that would help you detect this usage of message_body.html. Which is why 3Di recommended that an extension that tries to manipulate the ban reason such that it includes the additional HTML for your image may the the required solution.

If I was trying to implement that on my board, I would simply modify the /phpbb/session.php module to add the additional HTML to this "banned user" case directly, without using an extension. e.g. In phpBB 3.2.5, right after session.php line 1286, where you see other literal HTML being used to compose the banned user message:

Code: Select all

			$contact_link = phpbb_get_board_contact_link($config, $phpbb_root_path, $phpEx);
			$message = sprintf($this->lang[$message], $till_date, '<a href="' . $contact_link . '">', '</a>');
			$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>';
			
			// My additional message line to display a custom image:
			$message .= '<br /><img src="/myboard/images/banned.png">';
That comes with all the expected caveats of "you will lose this change every time you update phpBB", since the session.php will be overwritten with the shipping version again. But for such a small change, and for such a benign "cosmetic issue", that might be an acceptable cost and appropriate level of investment, compared to trying to get an extension created just for this. For what it's worth.