Hi Robert,Lumpy Burgertushie wrote: ↑Mon Mar 11, 2019 1:45 am why? please explain exactly what you are trying to accomplish.
which user? where? etc.
robert
page_header()
function within includes/functions.php
.Code: Select all
$user_rank = phpbb_get_user_rank($user->data, ($user->data['user_id'] != ANONYMOUS ? $user->data['user_posts'] : false));
Code: Select all
'CURRENT_USER_RANK_TITLE' => $user_rank['title'],
'CURRENT_USER_RANK_IMG' => $user_rank['img'],
{{ CURRENT_USER_RANK_TITLE }}
and {{ CURRENT_USER_RANK_IMG }}
to display the current user's rank where ever you want in the template.Receiving this error after the above edits:mrgoldy wrote: ↑Mon Mar 11, 2019 12:30 pm This will require some core modifications, especially in thepage_header()
function withinincludes/functions.php
.
Around this line add:Then after this line you could add:Code: Select all
$user_rank = phpbb_get_user_rank($user, ($user->data['user_id'] != ANONYMOUS ? $user->data['user_posts'] : false));
You should now be able to useCode: Select all
'CURRENT_USER_RANK_TITLE' => $user_rank['title'], 'CURRENT_USER_RANK_IMG' => $user_rank['img'],
{{ CURRENT_USER_RANK_TITLE }}
and{{ CURRENT_USER_RANK_IMG }}
to display the current user's rank where ever you want in the template.
Code: Select all
Fatal error: Uncaught Error: Cannot use object of type phpbb\user as array in /Applications/MAMP/htdocs/includes/functions_display.php:1524 Stack trace: #0 /Applications/MAMP/htdocs/includes/functions.php(4345): phpbb_get_user_rank(Object(phpbb\user), '423') #1 /Applications/MAMP/htdocs/index.php(251): page_header('A WoW Classic D...', true) #2 {main} thrown in /Applications/MAMP/htdocs/includes/functions_display.php on line 1524
Code: Select all
$user_rank = phpbb_get_user_rank($user->data, ($user->data['user_id'] != ANONYMOUS ? $user->data['user_posts'] : false));
Code: Select all
Fatal error: Uncaught Error: Call to undefined function phpbb_get_user_rank() in /Applications/MAMP/htdocs/includes/functions.php:4347 Stack trace: #0 /Applications/MAMP/htdocs/includes/functions.php(2485): page_header('Login') #1 /Applications/MAMP/htdocs/ucp.php(84): login_box('index.php') #2 {main} thrown in /Applications/MAMP/htdocs/includes/functions.php on line 4347
phpbb_get_user_rank()
is in functions_display.php
, which I thought was included everywhere, unfortunately it is not.phpbb_get_user_rank
, add the following:
Code: Select all
if (!function_exists('phpbb_get_user_rank'))
{
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
}
!function_exists()
makes sure it's only included if it is not already. However, if the display functions are included elsewhere after the page header is called, without a check, there might still be double inclusions.