Jump to content

Error Page Tags Error


Rob Pearson

Recommended Posts

Posted

Hello

On our custom error page we insert the IPB tags (error_message) as shown in image one:

4a340b2198a3d8bd03c51b763ff377ed.png

 

However upon access a restricted page and then revisiting the code it removed the IPB tags and replaced them with text. This means that error are no longer identified properly on our pages. It instead says 'sorry you do not have permission to view this page. See image below.

50a50e040af24b43c545804a5f7a7bf3.png

 

Surely the tags should remain so it can present different reasons/errors.

I look forward to getting this resolved.

 

Thanks

Rob

 

 

 

Posted

The errors are replaced on runtime in following method cms/Pages::errorPage

	/**
	 * Show a custom error page
	 *
	 * @param   string  $title          Title of the page
	 * @param	string	$message		language key for error message
	 * @param	mixed	$code			Error code
	 * @param	int		$httpStatusCode	HTTP Status Code
	 * @param	array	$httpHeaders	Additional HTTP Headers
	 * @return  void
	 */
	static public function errorPage( $title, $message, $code, $httpStatusCode, $httpHeaders )
	{
		try
		{
			$page = static::load( \IPS\Settings::i()->cms_error_page );
			$page->content = str_replace( '{error_message}', $message, $page->content );
			$page->content = str_replace( '{error_code}', $code, $page->content );
...

If you want to customize here something, you'll have to create a plugin and override this method.

Posted

Hello @Daniel F,

Thanks for the response.

I'm not looking to override the system i just want to know why when using the (error_message) tag it doesn't work and converts the tags into text.

Surely using the tag means it would detect different errors or is that not the case with custom error pages?

 

Thanks

Rob

Posted

It just seems the custom error tag doesn't detect the different errors but instead just checks the first one and then saves it as text. Still not found a solution yet.

Posted

Okay, I tried it and see the problem. That is actually a bug. Please open a ticket for that. 

The error page TEMPLATE gets changed once used, not just the front-end output. That’s clearly not intentional, but it wasn’t perfectly clear from your first post. 
Not sure what version you use, but I can confirm it for the latest 4.2 beta as well. 

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...