Code: Select all
<?php if(!$user->data['is_registered'])
{
if ($user->data['user_id'] != ANONYMOUS)
{
trigger_error('NOT_AUTHORISED');
}
login_box('', $user->lang['NOT_AUTHORISED']);
}
?>
Now I tried all sorts of variations of
Code: Select all
<?php if(!$user->data['is_registered'])
{
if ($user->data['user_id'] != ANONYMOUS)
{
trigger_error("You must be registered to view this area. Please press back and create an account", E_ALL);
}
?>
But as I understand it these do not work because all of the error_handlers are already defined by phpbb itself (either in functions.php or common.php?). I found this page, that discusses very close my exact issue.
https://wiki.phpbb.com/Talk:Function.trigger_error
" If you want to just halt the script and output something, you would use E_USER_ERROR, but you can also specify your own error handler, or define('HEADER_INC'); which will avoid calling page_header() within trigger error. If you seek additional assistance, please post a topic in the MOD Writers Discussion Forum."
Could somebody please help me make a bit more sense of that so I can try to sort this out. Thank you very much.
edit:
So I found this in includes/functions.php
Code: Select all
/**
* Generate page header
*/
function page_header($page_title = '', $display_online_list = false, $item_id = 0, $item = 'forum', $send_headers = true)
{
global $db, $config, $template, $SID, $_SID, $_EXTRA_URL, $user, $auth, $phpEx, $phpbb_root_path;
global $phpbb_dispatcher, $request, $phpbb_container, $phpbb_admin_path;
if (defined('HEADER_INC'))
{
return;
}
define('HEADER_INC', true);
but I don't understand, how can I use any of that to make NOT_AUTHORISED page return without header? ty