Registration hack question - put user details in a 2nd table?
Posted: Tue Jan 29, 2008 6:11 am
Hi,
How difficult would it be to hack the registration process so that some of a new user's details are added to another table in addition to the jos_users table?
To make it a bit more complicated, I'd need to choose which table they go in based on one of the registration fields.
Basically, what I'm trying to achieve is a workaround that will allow me to have people register on my Joomla! site (1.5 stable) and at the same time populate the "tokens" table for a survey system that would give them access to the surveys based on their Joomla! username as the token. Also, since there are multiple surveys, grouped by project, there are multiple token tables needing to be populated, and the appropriate tables would be determined by a field at registration that would have them choose the project (using JoomSuite's JUser component for the extended user details).
I would assume, if I have the survey tokens tables in the same database as Joomla!, that I can take advantage of at least some of the API - at least to connect to the database, etc. Could I then just add a routine to a registration related file that checks the input and chooses the table and then does an insert upon submission at the same time as the details are inserted into jos_user?
[edit - hit "post" too soon]
Or would it be better to do the registration and just add a trigger for an additional script that would query the database based on the $user variable that's available, and then do the insertion to the tokens table - making it a little more after the fact, and perhaps easier to manage when I have to change it?
If that would work, what would I need to add to the registration process to trigger the "external" script?
Thanks.
How difficult would it be to hack the registration process so that some of a new user's details are added to another table in addition to the jos_users table?
To make it a bit more complicated, I'd need to choose which table they go in based on one of the registration fields.
Basically, what I'm trying to achieve is a workaround that will allow me to have people register on my Joomla! site (1.5 stable) and at the same time populate the "tokens" table for a survey system that would give them access to the surveys based on their Joomla! username as the token. Also, since there are multiple surveys, grouped by project, there are multiple token tables needing to be populated, and the appropriate tables would be determined by a field at registration that would have them choose the project (using JoomSuite's JUser component for the extended user details).
I would assume, if I have the survey tokens tables in the same database as Joomla!, that I can take advantage of at least some of the API - at least to connect to the database, etc. Could I then just add a routine to a registration related file that checks the input and chooses the table and then does an insert upon submission at the same time as the details are inserted into jos_user?
[edit - hit "post" too soon]
Or would it be better to do the registration and just add a trigger for an additional script that would query the database based on the $user variable that's available, and then do the insertion to the tokens table - making it a little more after the fact, and perhaps easier to manage when I have to change it?
If that would work, what would I need to add to the registration process to trigger the "external" script?
Thanks.