I need to execute my 2 callback functions only if the password field is modified. how can i set it into password field ? currently i cant update any other record in the table because callbacks are running unnecessarly.
my code sample
function login() { $crud = new grocery_CRUD(); $crud->set_table('login'); $crud->set_subject('Login'); $crud->set_relation('staff_id', 'staff', '{staff_id} - {staff_name}'); $crud->display_as('staff_id', 'Staff ID / Staff Name'); $crud->set_relation('access_level_id', 'access_level', '{access_level_description}'; $crud->display_as('access_level_id', 'Access Level'); $crud->change_field_type('password', 'password'); $crud->callback_before_insert(array($this, 'encrypt_password')); $crud->callback_before_update(array($this, 'encrypt_password')); $crud->required_fields('user_name', 'password', 'staff_id', 'access_level_id'); $output = $crud->render(); $this->_example_output($output); }
Thank You.