View Full Version : Fields Required when Inserting new Users to database
Zantox
02-13-2013, 10:03 PM
Hello,
I've created my own global registration system, that registers to other services I offer, such as Mantis Bug Tracker.
I'm curious as to what fields need to be inserted to have a new user show up and what tables.
I assumed it was the 'user' table, and inserted a 'username' 'email' and 'password' but it didn't seem to work.
I feel like it needs to be inserted into other places as well?
Please Advise.
I know there should be a row in userfield and usertextfield (with matching userids of course), but I'm not sure if that's all you need.
Zantox
02-13-2013, 10:36 PM
I know there should be a row in userfield and usertextfield (with matching userids of course), but I'm not sure if that's all you need.
Well the table user also seems to be quite relevant. It contains the user data such as 'username' and 'password'
Well the table user also seems to be quite relevant. It contains the user data such as 'username' and 'password'
Yeah, sorry, I meant those other two in addition to the user table. You should insert a row into user, then get the userid of the inserted row and use it to insert rows into userfield and usertextfield. But like you said, the important information is in the user table so I'm not sure how important those others are (although I don't think the user shows up in the admincp if there aren't records in the other tables).
If you were using vbulletin code you could use the datamanager to add a user. Even if you aren't, you could look at includes/class_dm_user and see what it's doing.
Edit: And after reading Lynne's response below I realize that I was kind of assuming that you set all the important fields in the user table, but maybe that was your question - it could be that you didn't set something that's needed. I'm not sure which article Lynne means, but I found this one: www.vbulletin.org/forum/showthread.php?t=82836 It talks about using the datamanager, but it also has a list of fields with descriptions. And the example seems to say that you need username, email, password, and usergroupid at a minimum.
Lynne
02-14-2013, 12:24 AM
There is an article (although it is in the vb3 article forum) that outlines the information needed to be input into the database when a user is registered. It's an article about creating users. So, take a look at that and see what is there. You can also look at the registration.php file and see what is needed.
Zantox
02-14-2013, 09:42 PM
I read over that article and it didn't seem to be too specific as to what and where things need to be inserted.
Lynne
02-15-2013, 02:12 AM
Perhaps a better place for you to look is this page admincp/user.php?do=add . That is the page called when you want to add a user via the admincp.
Zantox
02-21-2013, 01:18 AM
After reading it over, it looks like the user table usertextfield and userfield.
But I'm not quite sure how to code that form.
Lynne
02-21-2013, 02:27 AM
You aren't sure how to code a form? Try here for the basics - http://www.w3schools.com/html/html_forms.asp
Zantox
02-22-2013, 12:08 AM
No I know how I'm going to do the form.
I'm talking about the php for inserting the fields and how to make it insert corresponding userid's in numerous tables.
Lynne
02-22-2013, 12:55 AM
You could take a look at the file I already pointed you to since it adds the information into the database. Do you code php at all? If not, you may want to hire someone to do what you want.
Zantox
02-22-2013, 02:18 AM
A little, php was never my focus. If I had the funding to hire someone, I would :P
I can look around some more.
If you're not including any vb code in the app you're creating, then you can use whatever language you want (you said it's an existing global registration system, so I guess it's been decided). If you are using php then you can use the mysql_query() function to do an insert to the user table, and don't specify a value for userid (or specify NULL). Then call mysql_insert_id() (http://us2.php.net/manual/en/function.mysql-insert-id.php) to get the userid created by the insert, and use that value as the userid when you insert rows in the userfield and usertextfield tables.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.