Hey there FlashUK, this is a great contribution. Thanks! Looking forward to v0.2 and then to v0.3. In the meantime, I was wondering if you have a tip on where to look for adding custom fields?
I see the users.php createProfile function, that it is creating the blank profile data, that I would modify register_form to add the new fields, and new validation as necessary. But from there I am not sure if you have already built in a way to add the extra form field data to the profile, or would we do that manually somehow?
[edit]
So far I am trying to do it manually by doing the validation, etc., in a controller, and if it passes, calling
if( $this->cl_auth->register($this->validation) )
{
$user = $this->users->getUserByUsername( $this->validation->username )->row();
}
I also added a simple setProfile to the cl_auth/users.php model:
function setProfile($user_id, $data)
{
$this->db->where('user_id', $user_id);
return $this->db->update($this->_profile_table, $data);
}
and then immediately afterwards calling register. If register() passes, I can set $data to my remaining custom field data and do a
$this->users->setProfile($user->id, $data);
to update the profile row just created by the register function. This is already pretty clean and readily customizable. And v0.2 improves on this process? :-) Oh, I am doing this in a controller and not a separate view because requirements changed and now it’s being called from Flash. I really like how this is working so far.
Very good stuff! And again many thanks for contributing it.
[edit 2]
I just realized that I was missing the validation checks username_check and email_check! So now the validation strings match and I use a check() function in my controller which calls and returns the value of $this->cl_auth->check(). I think I assumed those checks would be in the register function so that the form could be managed separately from the registration function but this works now. And with the way I am doing it (almost certainly not the best way!) I had to do an update instead of an insert on the “setProfile” code since the profile is initially set when creating the user.
All in all, it’s a clean light code base that makes sense and is good to work with. I can’t compare it much to the other auth modules because for reasons beyond me, my MAMP setup did not allow many of the Session modules to work (very strange and I didn’t have time to dig in to them), so some of the other auth modules couldn’t work, and CL_Auth worked straight away with the least fuss up front to just get it running.
Michael