Getting username - 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: Getting username (/thread-146093.html) |
Getting username - malcmail - 2013-09-30 For anyone that knows how to use this I'm sure it's a simple idea so I'm hoping someone can help. I'm using Page manager to knock up a form for our bulletin board. The form is simple html using <form>. Rather than have the user enter their name (because after all they will be logged in) how can I get the username to display automatically? I've had a look and found the code {mybb->user['username']} but I'm not sure how to put this within the page itself. CAn anyone give me any pointers please? Many thanks in advance. RE: Getting username - Matt - 2013-09-30 Putting {$mybb->user['username']} anywhere in a template should display it. Or if you mean you want to pre-populate a form field, this will work:
RE: Getting username - malcmail - 2013-09-30 (2013-09-30, 12:42 PM)Matt. Wrote: Putting {$mybb->user['username']} anywhere in a template should display it. Or if you mean you want to pre-populate a form field, this will work: Thanks for the swift reply. Prepopulating the form was what I was after. Was just away to say how it didn't work for me then realised the most stupid mistake of all - missed the $. Magic - thanks very much Wondered if I could pick your brains on something else. Can I do the same with todays date? If so what's the variable name? Thanks again. RE: Getting username - Matt - 2013-09-30 Don't think that'll be as easy; the $mybb object is available globally but I think the date is only available if it's set somewhere for a specific purpose (i.e. only if a template needs it, like the header). RE: Getting username - malcmail - 2013-09-30 Ah well. I'm ahead of my time Thanks again for your help with this. |