Welcome Guest, Not a member yet? Register   Sign In
library help
#1

[eluser]tim1965[/eluser]
Hi

I am using DX_auth for my authentication. Within the DX_auth library there is a section that allows you to trigger an event once the user has successfully registered. See below
// If DX_email_activation in config is TRUE,
// this event occurs after user succesfully activated using specified key in their email.
// If DX_email_activation in config is FALSE,
// this event occurs right after user succesfully registered.
function user_activated($user_id)
{
// Load models
$this->ci->load->model('dx_auth/user_profile', 'user_profile');

// Create user profile
$this->ci->user_profile->create_profile($user_id);
}
I need to run an "insert_id" at this point to extract dx_auths last id from its users table. I then need to run a query to pull off the "username" from its "users" table using this id. With the username i then need to to insert this into my own table for my website. Hope that is clear.

So my problem is that the above seems to be the right place to insert my code. However when i insert my code i get errors, that i think relates to the fact that i am not using CI &get;instance. So my question is how best to call my code from within this library. I ma very new to Codeigniters, so any help is very much appreciated. Oh and Happy New Year.
#2

[eluser]tim1965[/eluser]
Ok i am going to re-phrase the question. Does it matter if i call the model directly from the library to run this insert or should i be calling a controller to interact with the model. I just want this to run as a discrete insert (one time run at activation) and not get in the way of anything else that DX_auth's is doing. The event is the place to put it, but given this function is in a library, is it best practice to call the model (containing the insert) directly. Thanks again.




Theme © iAndrew 2016 - Forum software by © MyBB