i tested you solution , it doesn't show any error . there is any way to prevent to show edit page for that users or redirect that useres to a url ?
here is my code :
function test()
{
$crud = new grocery_CRUD();
$crud->set_theme('datatables');
$crud->set_subject('دسته جدید');
$crud->set_table('blog_category');
$crud->where('user_id',$this->user_id);
$crud->set_rules('name','نام دسته','encode_php_tags');
$crud->edit_fields('name','user_id');
$crud->add_fields('name','user_id');
$crud->change_field_type('user_id', 'invisible');
$crud->columns('name');
$crud->display_as('name','نام دسته');
$crud->callback_before_insert(array($this,'clear'));
$crud->callback_before_update(array($this,'check_user'));
$output = $crud->render();
$this->_example_output($output);
}
function clear($post_array=array(), $key = null)
{
//$post_array['name'] = $this->db->escape_str($this->security->xss_clean($post_array['name']));
$post_array['user_id'] = $this->user_id;
$post_array['parent_id']='1';
return $post_array;
}
function check_user($post_array=array(), $key = null)
{
if ($post_array['user_id']!=$this->user_id)
return false;
else
return true;
}
there are any problem ?