Questions and Answers

How do I collect points?

  • +4
    Chosen as best answer
  • +1
    Posted answer
  • +1
    Posted question
  • +1
    Thumb up
  • -1
    Thumb down
8

by Jeff in Coding about September 22, 2011 closed - report

How can I display the current username in the header?

I am trying to use: $this->viewer()->username in a PHP block in the header (see screenshot) to write out the current user's username, but it's not working? Maybe that value is not available in that context? Does anyone know any other options to write out the current username?

Answer: 1  •  Score 0  •  Views: 1855

1 Answer
Browse by
  • 8

    by Ori K about September 25, 2011 Best answer

    You can try to add it to the top menu code.

    In application/modules/Core/widgets/menu-mini/index.tpl‬ after

    viewer->getIdentity()) :?>

    add something like
  • viewer->getTitle(); ?>

  • Score: 0
2 comments
  • Ori K
    by Ori K
    September 25, 2011

    The php code was ruined...
    after the php line
    if( $this->viewer->getIdentity())
    add something like
    BEGIN_PHP echo $this->viewer->getTitle(); END_PHP

  • Jeff
    by Jeff
    September 27, 2011

    Thanks, Ori. That got me on the right track and I got it working! :)

Question was closed.