The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
How Can I insert the username of who submitted a form to the database?
Hello everyone, I am trying to capture the username of whoever submits a custom form I created. I need to insert that username of who submits the form into a database table I created. I need this to first have a record of who submitted the form and also to later print out the username next to the form submitted, as well as restrict later access to that form using if conditions, but first I need to get that username. Any one has any ideas how to go about this or point me in the right direction?? Please any information would be very useful. Thank you for your time everyone.
|
#2
|
|||
|
|||
I think the username should be available in $vbulletin->userinfo['username'].
|
#3
|
|||
|
|||
Right but how does the form know that? Should I just insert that while I'm inserting the form values? I don't get how that knows that that form was submitted by that user. Anyone can explain please??
This is my form: HTML Code:
{vb:stylevar htmldoctype} <html xmlns="http://www.w3.org/1999/xhtml" dir="{vb:stylevar textdirection}" lang="{vb:stylevar languagecode}" id="vbulletin_html"> <head> <title>{vb:raw vboptions.bbtitle} - {vb:raw pagetitle}</title> {vb:raw headinclude} {vb:raw headinclude_bottom} </head> <body> {vb:raw header} {vb:raw navbar} <div id="pagetitle"> <h1>{vb:raw pagetitle}</h1> </div> <div id="usercp_content"> {vb:raw oftw_sidemenu} <div class="cp_content" style="width: 80%; float: right;"> <h2 class="blockhead">Contests Of The Week</h2> <div class="blocksubhead"> <center><form action="nominate.php" method="post"> Enter Image URL to Nominate: <input type="text" name="imgurl"><input type="submit" name="submit"> </form> </center> </div> {vb:raw print_nominations} </div> </div> {vb:raw footer} </body> </html> PHP Code:
|
#4
|
|||
|
|||
When you include global.php, it does a lot of stuff for you like makes sure the user is logged in (actually you have to check that - if the user id is '0' then the user is an unregistered guest). So hopefully the answer to your question is that it should all be handled by including global.php.
(If this doesn't answer your question I'll let someone else try ) |
#5
|
||||
|
||||
PHP Code:
|
#6
|
|||
|
|||
P E R F E C T !! I knew it had to be something simple Thank you SOO much Disasterpiece, hopefully you'll be seeing my first mod up here soon enough? Thanks to everyone's help, it's really easy to learn anything when you have this level of support. Thanks guys.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|