How to display the user name on the main page(main.tpl)?
{usertitle} displays nothing.

And how to display the user's photo in the same place?

1 Answers 1

In engine/modules/main.php
find
$tpl->result['main']=str_replace('src="http://'.$_SERVER['HTTP_HOST'].'/','src="/', $tpl->result['main']);

below add
$tpl->result['main']=str_replace("{username}", $is_logged? $member_id['name']:'Guest', $tpl->result['main']);//in the template use the tag {username}(checked)
$tpl->result['main']=str_replace("{userfoto}", $is_logged? $member_id['foto']:'//placehold.it/100x100', $tpl->result['main']);//in the template use the {userfoto} tag is the avatar url(did not check, should work)
  • Nick is displayed, but the photo is not.Are there any fixes? – Successful Snail Mar 24 '19 at 16:29
  • [[97artur97]],
    instead of the second line
    $tpl->result['main']=str_replace("{userfoto}", $member_id['foto'], $tpl->result['main']);
    – Rock 'n' Mar 25 '19 at 14:37
  • [[Kennius]] doesn't work either – Successful Snail Mar 26 '19 at 04:39
  • [[97artur97]], dle 13.1 everything works – Rock 'n' Mar 26 '19 at 07:05
  • [[Kennius]], And I have 12.1 and the photo does not work – Successful Snail Mar 26 '19 at 11:04
  • [[Kennius]], Put 13.2, but still the photo does not work.Any suggestions? – Successful Snail Mar 30 '19 at 21:49