application/controllers/admin/User.php
/* Delete the user and associated data */
Delete the user and associated data
Delete the user and associated data
public function delete_user($userId=NULL)
    {
        if(!empty($userId))
        {
            $userId=$userId;
        }
        else
        {
            $userId=$this->uri->segment(4);
        }
        $record_per_page = $this->uri->segment('5');
        $searchtext = $this->uri->segment('6');
        $startDate = $this->uri->segment('7');
        $endDate = $this->uri->segment('8');
        $criteria = $this->uri->segment('9');
        $sortby = $this->uri->segment('10');
        $order = $this->uri->segment('11');
            $query=$this->User_model->delete_user($userId);
            if ($query) {
                $this->session->set_flashdata('success_message', 'User deleted successfully');
                redirect('admin/User/user_list/'.$record_per_page.'/'.$searchtext.'/'. $startDate.'/'.$endDate.'/'.$criteria.'/'.$sortby.'/'.$order.'/1','refresh');
            }else{                
                    $this->session->set_flashdata('failure_message', 'Fail to delete user');
                    redirect('admin/User/user_list/'.$record_per_page.'/'.$searchtext.'/'. $startDate.'/'.$endDate.'/'.$criteria.'/'.$sortby.'/'.$order.'/1','refresh');                                        
            }
    }
public function delete_user ( $ userId = NULL ) { if ( ! empty ( $ userId ) ) { $ userId = $ userId ; } else { $ userId = $ this -> uri -> segment ( 4 ) ; } $ record_per_page = $ this -> uri -> segment ( '5' ) ; $ searchtext = $ this -> uri -> segment ( '6' ) ; $ startDate = $ this -> uri -> segment ( '7' ) ; $ endDate = $ this -> uri -> segment ( '8' ) ; $ criteria = $ this -> uri -> segment ( '9' ) ; $ sortby = $ this -> uri -> segment ( '10' ) ; $ order = $ this -> uri -> segment ( '11' ) ; $ query = $ this -> User_model -> delete_user ( $ userId ) ; if ( $ query ) { $ this -> session -> set_flashdata ( 'success_message' , 'User deleted successfully' ) ; redirect ( 'admin/User/user_list/' . $ record_per_page . '/' . $ searchtext . '/' . $ startDate . '/' . $ endDate . '/' . $ criteria . '/' . $ sortby . '/' . $ order . '/1' , 'refresh' ) ; } else { $ this -> session -> set_flashdata ( 'failure_message' , 'Fail to delete user' ) ; redirect ( 'admin/User/user_list/' . $ record_per_page . '/' . $ searchtext . '/' . $ startDate . '/' . $ endDate . '/' . $ criteria . '/' . $ sortby . '/' . $ order . '/1' , 'refresh' ) ; } }
Delete the user and associated data
Delete the user and associated data
//echo $startDate;exit(); // $startDate = date("Y-m-d");  // $endDate = date('Y-m-d',strtotime("-1 days"));