MyBB Community Forums
[How To?] Echo back the user name - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Community Archive (https://community.mybb.com/forum-106.html)
+--- Forum: Archived Forums (https://community.mybb.com/forum-143.html)
+---- Forum: Archived Development and Support (https://community.mybb.com/forum-155.html)
+----- Forum: MyBB 1.6 (https://community.mybb.com/forum-138.html)
+------ Forum: 1.6 General Support (https://community.mybb.com/forum-127.html)
+------ Thread: [How To?] Echo back the user name (/thread-130131.html)



Echo back the user name - Senethic - 2012-11-28

Hello $player,

See what I did there?
I want to echo back the user who is currently reading the thread.

Thank you for your time.

Regards,

Senethic


RE: Echo back the user name - Nathan Malcolm - 2012-11-28

You can use {$mybb->user['username']} in templates. Smile


RE: Echo back the user name - Senethic - 2012-11-28

(2012-11-28, 09:39 PM)Nathan Malcolm Wrote: You can use {$mybb->user['username']} in templates. Smile

Hey Nathan,

Thanks for the quick reply, Will i be able to use this in a postbit ?


RE: Echo back the user name - Nathan Malcolm - 2012-11-28

You can use it in any template, it's a global variable. Smile


RE: Echo back the user name - Senethic - 2012-11-28

(2012-11-28, 09:43 PM)Nathan Malcolm Wrote: You can use it in any template, it's a global variable. Smile

Let me correct myself, would I be able to use it in a post* ?
I know that you can use variables in the back-end but I wonder how I could call up that variable on the frontend in a post Big Grin.


RE: Echo back the user name - Nathan Malcolm - 2012-11-28

You'd have to create a custom plugin which uses the parser to create dynamic MyCodes. Being able to echo arbitrary variables in posts would be a cause for concern.


RE: Echo back the user name - Senethic - 2012-11-28

(2012-11-28, 09:49 PM)Nathan Malcolm Wrote: You'd have to create a custom plugin which uses the parser to create dynamic MyCodes. Being able to echo arbitrary variables in posts would be a cause for concern.

Alright, my friend is a PHP Dev, I'll get this sorted.
Thank you for your awesome support Nathan.