Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Not Solved Getting username
#1
Not Solved
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.
#2
Not Solved
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:

<input type="text" name="name" id="id" value="{$mybb->user['username']}" />
MyReactions - All Plugins

Can you still feel the butterflies?

Free never tasted like pudding.
#3
Not Solved
(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:

<input type="text" name="name" id="id" value="{$mybb->user['username']}" />

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.
#4
Not Solved
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).
MyReactions - All Plugins

Can you still feel the butterflies?

Free never tasted like pudding.
#5
Not Solved
Ah well. I'm ahead of my time Wink

Thanks again for your help with this.


Forum Jump:


Users browsing this thread: 5 Guest(s)