Board disabled, maintenance mode

Discussion forum for Extension Writers regarding Extension Development.
Post Reply
User avatar
Bryx
Registered User
Posts: 35
Joined: Mon Oct 30, 2017 7:14 am
Contact:

Board disabled, maintenance mode

Post by Bryx »

Hello,

I a problem with my extension phpBB 3.2.
I can't get a maintenance page

Example:
- If the forum is not in maintenance, it is forumatix_enable.html
- If the forum is in maintenance, it is forumatix_disable.html

What I want to do is that when I have no maintenance mode, the default page is displayed and when the Forum maintenance is active it displays the maintenance page of my extension.

Extension file :

[The extension zip has been deactivated and can no longer be displayed.]

Thank you for support.
Bryx
User avatar
RMcGirr83
Former Team Member
Posts: 22016
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: Board disabled, maintenance mode

Post by RMcGirr83 »

What is "maintenance"?
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then buy me a beer Image
User avatar
Bryx
Registered User
Posts: 35
Joined: Mon Oct 30, 2017 7:14 am
Contact:

Re: Board disabled, maintenance mode

Post by Bryx »

It is a French vocabulary, it is to say that the forum is unavailable.
User avatar
Bryx
Registered User
Posts: 35
Joined: Mon Oct 30, 2017 7:14 am
Contact:

Re: Board disabled, maintenance mode

Post by Bryx »

A idea ?
User avatar
RMcGirr83
Former Team Member
Posts: 22016
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: Board disabled, maintenance mode

Post by RMcGirr83 »

Maybe can be done within the core.page_header_after or possibly the core.user_setup event.
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then buy me a beer Image
User avatar
Bryx
Registered User
Posts: 35
Joined: Mon Oct 30, 2017 7:14 am
Contact:

Re: Board disabled, maintenance mode

Post by Bryx »

Thank you for informations and help.

I found this code

Code: Select all

// Is board disabled and user not an admin or moderator?
		if ($config['board_disable'] && !defined('IN_LOGIN') && !defined('SKIP_CHECK_DISABLED') && !$auth->acl_gets('a_', 'm_') && !$auth->acl_getf_global('m_'))
		{
			if ($this->data['is_bot'])
			{
				send_status_line(503, 'Service Unavailable');
			}

			$message = (!empty($config['board_disable_msg'])) ? $config['board_disable_msg'] : 'BOARD_DISABLE';
			trigger_error($message);
		}
How suited to my extension, in reality I'm not an expert in PHP just a small beginner who tries to learn.
User avatar
RMcGirr83
Former Team Member
Posts: 22016
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: Board disabled, maintenance mode

Post by RMcGirr83 »

You fire it (trigger_error) within your code using the event.
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then buy me a beer Image
User avatar
Bryx
Registered User
Posts: 35
Joined: Mon Oct 30, 2017 7:14 am
Contact:

Re: Board disabled, maintenance mode

Post by Bryx »

Here is the code used to create the event

Code: Select all

	/**
	 * Mode board disabled
	 */
	public function add_page_header_disabled()
	{
		if ($config['board_disable'] && !defined('IN_LOGIN') && !defined('SKIP_CHECK_DISABLED') && !$auth->acl_gets('a_', 'm_') && !$auth->acl_getf_global('m_'))
		{
			$message = (!empty($config['board_disable_msg'])) ? $config['board_disable_msg'] : 'BOARD_DISABLE';
			trigger_error($message);
		}
	}
This seems to you correct, if so how to fit my custom template that found in the extension knowing that it does not help the head or the base foot of the forum.

Thank you for your time =)
User avatar
mrgoldy
Former Team Member
Posts: 1394
Joined: Tue Oct 06, 2009 7:34 pm
Location: The Netherlands
Name: Gijs
Contact:

Re: Board disabled, maintenance mode

Post by mrgoldy »

It's really hard to understand what you want and to explain it to you without writing the entire extension for you.

You can't just 'write your own event'. You have to hook into one of the PHP Core Events and use that in your event/listener.php.
Here you can find all available phpBB Event locations.
I would suggest looking through the phpBB’s extension development tutorial and documentation.
And perhaps look at some already existing (and validated) extensions, such as: Hope this helps,
phpBB Studio / Member of the Studio

Contributing: You can do it too! Including testing Pull Requests (PR).
phpBB Development and Testing made easy.
Post Reply

Return to “Extension Writers Discussion”