$this->ag_auth->restrict('admin');
$crud = new grocery_CRUD();
$crud->set_table('tblusers')
->set_subject('Users')
->columns('usrName','usrFullName','usrGender','usrPassword','usrEmail','usrCompany','usrFunction')
->fields('usrName','usrFullName','usrPassword','usrGender','verification','usrEmail','usrCompany','usrFunction')
->change_field_type('usrPassword','password')
//display fieldname, shown text
->display_as('usrId','ID')
->display_as('usrName','Username')
->display_as('usrFullName','Full name')
->display_as('usrGender','Gender')
->display_as('usrPassword','Password')
->display_as('usrEmail','Email')
->display_as('usrCompany','Company')
->display_as('usrFunction','Function')
//validation
->set_rules('usrName', 'Username', 'required|min_length[5]|max_length[30]')
->set_rules('usrFullName', 'Full name', 'required|min_length[5]|max_length[80]')
->set_rules('usrGender', 'Gender', 'required|min_length[1]|max_length[1]')
->set_rules('usrPassword', 'Password', 'required|min_length[6]|max_length[32]');
$crud->change_field_type('grpCompId', 'hidden', companyId());
$crud->set_relation('usrCompany','tblCompanies','compName');
$this->grocery_crud->callback_field('verification','verificationField');
$this->grocery_crud->callback_column('usrPassword',array($this,'emptyField'));
$output = $crud->render();
$this->_example_output($output);
function verificationField()
{
return '+30 <input type="password" maxlength="50" value="" name="pasVer" style="width:462px">';
}
function emptyField($value,$row)
{
return '';
}
Password verification field
- Single Page
Posted 05 April 2012 - 08:24 AM
Posted 06 April 2012 - 08:25 AM
Example I have a news database with categories
user "auto" - can modify the news in category auto.
when you edit - the link is: /crud/news/edit/{id} , if you manually enter another id at the end of the link - you get the info and you can edit it too.
I'd like to make a check if the proper user is editing then do the edit. IF you manage to find a solution for your password problem , please post it here, i'll do the same if I find it first =)
Posted 06 April 2012 - 13:59 PM
This is wrong:
$this->grocery_crud->callback_field('verification','verificationField');
$this->grocery_crud->callback_column('usrPassword',array($this,'emptyField'));
The right thing is to write:
$crud->callback_field('verification','verificationField');
$crud->callback_column('usrPassword',array($this,'emptyField'));