How To Show Current User’s Name Anywhere On Website

Sometimes you want to address all users by their name but it is not possible to write each name by yourself. Imagine if you have 1 million registered users and you want to direct a message to them addressing each by their name, can you write so many names by yourself? Of course you can’t and that is why we have machines. Here is how you can display current user’s name anywhere.

Step 1:

Decide where you want to show it. If you want it in header go to styles / yourtheme / layout, open header.html, for footer open footer.html, for main page open index.html and so on.

Step 2:

Paste this code wherever you want the name to appear.


Yes, that is all you need to do. Now you can address to any user like this.

Hello {$userquery->username}! How are you?

If it is admin it prints: Hello admin! How are you?

1 Star2 Stars3 Stars4 Stars5 Stars (5 votes, average: 3.80 out of 5)