Customizing SMF > Tips and Tricks
[TRICK] Show an error when a guest tries to view a topic
(1/1)
Yoshi:
Since this has been requested several times now, and I've posted a solution before, here goes:
In /Sources/Display.php, find this:
--- Code: (Find) --- // What are you gonna display if these are empty?!
if (empty($topic))
fatal_lang_error('no_board', false);
--- End code ---
And add this after:
--- Code: (Add after) --- // Are we a guest?
if ($context['user']['is_guest'])
fatal_lang_error('cannot_view_topic_guest');
--- End code ---
Then, in your Modifications.{language}.php, add this before the ?> and change the message:
--- Code: ---$txt['cannot_view_topic_guest'] = 'The error you would like in here';
--- End code ---
So if I'd like to have "Sorry, guest, but you are unable to view topics!" as error message, I'd put this in:
--- Code: ---$txt['cannot_view_topic_guest'] = 'Sorry, guest, but you are unable to view topics!';
--- End code ---
So now guests should be unable to view topics and instead get that message smashed in their face ;)
Doctor Deejay:
Nice trick :)
Yoshi:
Thanks, and thank you for reminding me to post a trick for it ;)
Navigation
[0] Message Index
Go to full version