Registration Help
Permalink
Hi All,
Need help solving a problem with the self-registration!!!
Just finished installing and configuring Concrete5 and have been pleasantly surprised by how easy it is to use. Added a couple blocks from the marketplace, made a custom theme, and configure the sites access with ease.
The site is going to be visible to registered users only so we need the public registration page to work: mysite.com/index.php/register. The form works great, validation happens without a hitch, and the users table in the database is even populated properly but all the user gets after submission is a blank page, HTTP500, no PHP errors.
I have 'Registration with Email Validation' enabled and it seems to fail somewhere between inserting the user in the database and sending out the validation email.
Has anyone seen this type of problem before? Any ideas where I should start to track the problem down?
Thanks in advance!
Need help solving a problem with the self-registration!!!
Just finished installing and configuring Concrete5 and have been pleasantly surprised by how easy it is to use. Added a couple blocks from the marketplace, made a custom theme, and configure the sites access with ease.
The site is going to be visible to registered users only so we need the public registration page to work: mysite.com/index.php/register. The form works great, validation happens without a hitch, and the users table in the database is even populated properly but all the user gets after submission is a blank page, HTTP500, no PHP errors.
I have 'Registration with Email Validation' enabled and it seems to fail somewhere between inserting the user in the database and sending out the validation email.
Has anyone seen this type of problem before? Any ideas where I should start to track the problem down?
Thanks in advance!
Well the fix was easy but finding the fix was difficult. not sure if this is bug in the code or not but here's the short and long answers.
The short answer:
The simple answer is to check your config table and make sure the values are correct. My solution was to change the value of 'USER_REGISTRATION_APPROVAL_REQUIRED' in the Config table to '0'.
Prior to deciding on 'Registration Open, Email Validation' the registration setting had been set to 'Approval Required'. However this didn't update in the database when it was changed on the Dashboard. Nor did it update on future attempts to set 'Approval Required' and then unset through the dashboard.
The long answer:
This misconfiguration error shouldn't have caused the error I was receiving. However, when I traced the issue through back through the User Model I discovered some design inconstancies in how new Instances are created which in the end was the root of the problem.
On line 133 of the Register Controller a new Instance of 'User' is created.
This instance is then used on line 142, but only if you have 'USER_REGISTRATION_APPROVAL_REQUIRED' set to true.
The problem arises when you also have 'USER_VALIDATE_EMAIL_REQUIRED' set to true.
Unlike the Register Controller the User Model doesn't check for 'USER_REGISTRATION_APPROVAL_REQUIRED' prior to checking for 'USER_VALIDATE_EMAIL_REQUIRED' so none of the instance's properties are set. And because these properties are not set the Register Controller just stops when it attempts to access these properties on line 142.
So this error can/will only occur if both 'USER_REGISTRATION_APPROVAL_REQUIRED' and 'USER_VALIDATE_EMAIL_REQUIRED' are set to true.
Still not sure why a PHP error isn't output!
The short answer:
The simple answer is to check your config table and make sure the values are correct. My solution was to change the value of 'USER_REGISTRATION_APPROVAL_REQUIRED' in the Config table to '0'.
Prior to deciding on 'Registration Open, Email Validation' the registration setting had been set to 'Approval Required'. However this didn't update in the database when it was changed on the Dashboard. Nor did it update on future attempts to set 'Approval Required' and then unset through the dashboard.
The long answer:
This misconfiguration error shouldn't have caused the error I was receiving. However, when I traced the issue through back through the User Model I discovered some design inconstancies in how new Instances are created which in the end was the root of the problem.
On line 133 of the Register Controller a new Instance of 'User' is created.
$u = new User($_POST['uName'], $_POST['uPassword']);
This instance is then used on line 142, but only if you have 'USER_REGISTRATION_APPROVAL_REQUIRED' set to true.
if(defined('USER_REGISTRATION_APPROVAL_REQUIRED') && USER_REGISTRATION_APPROVAL_REQUIRED) { $ui = UserInfo::getByID($u->getUserID()); $ui->deactivate(); //$this->redirect('/register', 'register_pending', $rcID); $redirectMethod='register_pending'; $registerData['msg']=$this->getRegisterPendingMsg(); // now we check whether we need to validate this user's email address } elseif (defined("USER_VALIDATE_EMAIL")) { if (USER_VALIDATE_EMAIL > 0) { $uHash = $process->setupValidation(); $mh = Loader::helper('mail'); $mh->addParameter('uEmail', $_POST['uEmail']); $mh->addParameter('uHash', $uHash); $mh->to($_POST['uEmail']); $mh->load('validate_user_email');
Viewing 15 lines of 21 lines. View entire code block.
The problem arises when you also have 'USER_VALIDATE_EMAIL_REQUIRED' set to true.
Unlike the Register Controller the User Model doesn't check for 'USER_REGISTRATION_APPROVAL_REQUIRED' prior to checking for 'USER_VALIDATE_EMAIL_REQUIRED' so none of the instance's properties are set. And because these properties are not set the Register Controller just stops when it attempts to access these properties on line 142.
So this error can/will only occur if both 'USER_REGISTRATION_APPROVAL_REQUIRED' and 'USER_VALIDATE_EMAIL_REQUIRED' are set to true.
Still not sure why a PHP error isn't output!
- the view page for the register form
/concrete/single_pages/register.php
- the controller for the register form
/concrete/controllers/register.php
- the user class
/concrete/models/user.php
- the user info class
/concrete/models/userinfo.php