Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: Doug Heffernan on February 25, 2018, 11:48:01 AM

Title: Error message is not being displayed
Post by: Doug Heffernan on February 25, 2018, 11:48:01 AM
Hello,

I am writing a mod and so far so good. The only issue that I am having is that the error message will not be displayed. I get only the standard error message, but without my custom error message.

What I am trying to do is show an error to guests when they view the topics if certain criteria is met. I am using this code to display the error message after the criteria is met, at the Display.php file in the Sources folder.

if ($context['user']['is_guest'])
fatal_lang_error('my_error_message', false);


Any pointers will be much appreciated.
Title: Re: Error message is not being displayed
Post by: Pipke on February 25, 2018, 01:04:21 PM
https://wiki.simplemachines.org/smf/Using_the_SMF_language_system_in_your_mods

so your text will be then:
$txt['my_error_message'] = 'my_error_message text';
Title: Re: Error message is not being displayed
Post by: Doug Heffernan on February 25, 2018, 02:51:31 PM
Quote from: Pipke on February 25, 2018, 01:04:21 PM
https://wiki.simplemachines.org/smf/Using_the_SMF_language_system_in_your_mods

so your text will be then:
$txt['my_error_message'] = 'my_error_message text';

Thank you for your reply. Yes, I have the language string created. Also if I hard code the error message, it displays nothing as well.
Title: Re: Error message is not being displayed
Post by: Illori on February 25, 2018, 02:58:16 PM
then you need to post more code so we can see what you are doing.
Title: Re: Error message is not being displayed
Post by: Doug Heffernan on February 25, 2018, 03:07:29 PM
Quote from: Illori on February 25, 2018, 02:58:16 PM
then you need to post more code so we can see what you are doing.

I did a fresh install of Smf and tried it again and now the error is being outputed correctly. Now I have to package up the mod.