A
A
Arthur2019-03-24 01:03:18
DLE
Arthur, 2019-03-24 01:03:18

How to display username in .tpl pages?

How to display the username on the main page (main.tpl)?
{usertitle} outputs nothing.
And how to display the user's photo in the same place?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Tutubalin, 2019-03-24
@Kennius

In engine/modules/main.php
find
add below

$tpl->result['main'] = str_replace ( "{username}", $is_logged ? $member_id['name'] : 'Гость', $tpl->result['main'] ); // в шаблоне использовать тег {username} (проверял)
$tpl->result['main'] = str_replace ( "{userfoto}", $is_logged ? $member_id['foto'] : '//placehold.it/100x100', $tpl->result['main'] ); // в шаблоне использовать тег {userfoto} это url аватара(не проверял, должно работать)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question