How to Get a Current User name in HTML block

Re: How to Get a Current User name in HTML block

by Justin Hunt -
Number of replies: 0
Picture of Particularly helpful Moodlers Picture of Plugin developers

As Jon and Al said, if you just want the name in a regular html block you do not need to code anything. With the help of the Generico or FilterCodes plugins, you can do quite a lot. I would not advise PHP coding unless you really need to. Most of the time it is not necessary and will hold you back later.

However if you do need/want to PHP code. There is a function that will prepare the users fullname. In that case try:

fullname($USER) or fullname($USER->id)


Average of ratings: Useful (1)