Hi,
When I try to update one of my records I receive neither a confirmation message nor a failure message.
The row remains unchanged.
Is there any tips on how I can get the error message?
This is my database:
http://i.imgur.com/qmssp5e.png
This is my code:
[spoiler]
<?php
ini_set('display_errors', '1');
class User extends CI_Controller {
public function __construct()
{
parent::__construct();
if (!$this->general->isLoggedIn()) {
header('Refresh: 0; url=' . base_url("login") . '');
die();
}
if (!$this->general->checkAccess("users")) {
header('Refresh: 0; url=' . base_url("denied") . '');
die();
}
$this->load->library('grocery_CRUD');
$this->load->library('ipbwi/ipbwi');
}
function index() {
$this->userlist();
}
function userlist() {
if (!$this->general->isLoggedIn()) {
header('Refresh: 0; url=' . base_url("login") . '');
die();
}
if (!$this->general->checkAccess("users")) {
header('Refresh: 0; url=' . base_url("denied") . '');
die();
}
$crud = new grocery_CRUD();
$crud->set_table('users')
->set_subject('Users')
->columns('username','email', 'firstname', 'lastname')
->display_as('username','User name')
->display_as('email','Email')
->display_as('firstname','First name')
->display_as('lastname','Last name');
$crud->callback_before_update(array($this,'encrypt_password_callback'));
$crud->callback_edit_field('password',array($this,'set_password_input_to_empty'));
$crud->callback_before_update(array($this,'check_admin_callback'));
$crud->set_rules('email', 'Email', 'required|valid_email');
$crud->set_rules('comission_percent', 'Comission percent', 'is_natural|less_than[101]');
$crud->unset_print();
$crud->unset_export();
$crud->unset_delete();
$crud->unset_add();
$crud->set_relation('country_id','countries','name');
$crud->fields('username', 'email', 'password', 'firstname', 'lastname', 'exclusive_author',
'firmname', 'country_id', 'profile_title', 'profile_desc', 'featured_author', 'referals', 'register_datetime',
'ip_address', 'status', 'comission_percent');
$crud->required_fields('email', 'firstname', 'lastname', 'exclusive_author',
'country_id', 'featured_author', 'referals', 'status', 'firmname');
$crud->display_as('firmname','Company')->display_as('profile_desc','Profile description')
->display_as('profile_desc','Profile description')->display_as('register_datetime','Registered')
->display_as('ip_address','IP')->display_as('country_id','Country');
$crud->field_type('username', 'readonly');
$crud->field_type('ip_address', 'readonly');
$crud->field_type('register_datetime', 'readonly');
// Pass grid to the view
$data['page_grid'] = $crud->render();
$data['page'] = 'user';
$view = $this->load->view('user/userlist', $data, TRUE);
$this->template->create_page('Users', $view);
}
public function encrypt_password_callback($post_array,$primary_key) {
if($post_array['password'] == '')
{
unset($post_array['password']);
return $post_array;
}
$post_array['password'] = md5(md5($post_array['password']));
$this->ipbwi->member->updatePassword ($post_array['password'], $this->general->userIdToUsername($primary_key));
$this->ipbwi->member->updateMember(array('email' => $post_array['email']), $this->general->userIdToUsername($primary_key));
return $post_array;
}
function log_user_after_update($post_array,$primary_key)
{
// $user_logs_update = array(
// "user_id" => $primary_key,
// "last_update" => date('Y-m-d H:i:s')
// );
//
// $this->db->update('user_logs',$user_logs_update,array('user_id' => $primary_key));
return true;
}
function set_password_input_to_empty() {
return "<input type='password' name='password' value='' />";
}
public function check_admin_callback($primary_key)
{
$username = $this->general->userIdToUsername($primary_key);
if($this->ipbwi->group->isInGroup(7, $this->ipbwi->member->name2id($username), true))
return false;
else
return true;
}
}
?>
[/spoiler]
I have attempted to comment out all callbacks, still no luck, and it is working perfectly on other databases.
