Page 1 of 1

user reg email activation tutorial

Posted: Wed Dec 07, 2011 3:19 pm
by shaunthomson
Hi guys

I'm stumped figuring out this problem.

If I enter registration details for a user, hit submit, and get the activation email, the system won't let me enter another registration until that first one is activated.

If I try to register someone else, no user data gets added to the table, although the activation table does get populated with data (albeit with a user_id of zero, as $user_id = mysql_insert_id(); returns '0' because no user data gets entered.

Once I activate the user, I can then successfully register another.

How do I make it so that there can be more registrations while activations are pending?

Thanks guys

Shaun

Re: user reg email activation tutorial

Posted: Wed Dec 07, 2011 6:45 pm
by jacek
Are the *_id columns all set to be auto_increment ? It could be that you are trying to inster a row that already exists the second time because the ID is not being increased ?

Re: user reg email activation tutorial

Posted: Thu Dec 08, 2011 1:59 am
by shaunthomson
I have the user_id column in the users' table set to auto increment. But it shouldn't be auto increment in the activations table, because we're inserting the user_id along with the aid, right?

It's very bizarre - it definitely won't let me add a new user to the users' table until any pending activations have been completed. Is this not the case when you try it?

Thanks Jace

Re: user reg email activation tutorial

Posted: Thu Dec 08, 2011 2:10 am
by shaunthomson
Never mind!!!!

I'd added queries to select a code from a pool of allowed codes when the user is activated, create a folder named after this code, do some other stuff, and then insert the code into the user's table once everything has been successfully completed.

The problem was that I'd set the user_code column I'd created in the user's table to be unique. And of course the user doesn't have a code allocated at first, so the user_code is empty. Try to add another user with an empty user_code, and because it's unique, it won't let you.

Got rid of the unique setting for the user_code, and it's fine.

I'd made it unique as a fail safe in case there was ever an error in my code pool generator producing two identical user codes. But I've moved that fail safe to the code generator script, and all is fine now.

Thanks for your replies Jace (is it Jace?) - set me on the right track to figure it out.

Re: user reg email activation tutorial

Posted: Thu Dec 08, 2011 10:11 pm
by jacek
shaunthomson wrote: The problem was that I'd set the user_code column I'd created in the user's table to be unique. And of course the user doesn't have a code allocated at first, so the user_code is empty. Try to add another user with an empty user_code, and because it's unique, it won't let you.

Got rid of the unique setting for the user_code, and it's fine.

I'd made it unique as a fail safe in case there was ever an error in my code pool generator producing two identical user codes. But I've moved that fail safe to the code generator script, and all is fine now.
Well I would never have guessed that ;)

It's good that you worked it out yourself though, generally you learn more that way :)
shaunthomson wrote:Thanks for your replies Jace (is it Jace?)
Jacek ;)