I use ion_auth as user management. If an user change his password, the site will redirect to logout controller. But if he is admin and he changes password for another user, it doesn't need logout.
My code:
$crud->callback_update ( array ( $this, 'edit_user_callback' ) );
Function edit_user_callback
function edit_user_callback($post_array, $primary_key = null) { $email = $post_array ['email']; $groups = $post_array ['groups']; if ($post_array ['change_password'] == 0) { $data = array ( 'email' => $email ); } else { $password = $post_array ['password']; $data = array ( 'email' => $email, 'password' => $password ); } $this->ion_auth->update ( $primary_key, $data, $groups ); if (($primary_key == $this->ion_auth->get_user_id ()) && (isset ( $post_array ['password'] ))) { //need redirect here redirect ( 'auth/logout' ); } return true; }
It doesn't redirect and stuck at edit page.
I already read www.grocerycrud.com/forums/topic/324-workaround-redirect-to-the-list-after-insertupdate-without-changing-the-core-functionality-of-gc/
but it doesn't help, I only need redirect if condition is true.
Could you please help me?
Thank.