Search code examples
codeigniter-3grocery-crudion-auth

How to disable a specific delete button in grocery_crud


In my user management page, I want to disable the delete button of my super admin account so that it can't be deleted. I used ion_auth for authentication and grocery_crud for my crud functions. How can I accomplish that? Any help? :)


Solution

  • i faced same problem and there is one quick that i know .

    make superadmin userid 1 and in php part check if userid = 1 like this

    $user_id = $this->ion_auth->user()->row()->id;
    if($user_id == 1){
    // this is superadmin do not delete
    }else{
    // your delete functions
    }