08-24-2016, 02:44 PM
awesome, i think I've got it working, may not be the best way but seems to work, in admin_users.php find
`if($validation->passed()) {
$form_valid = TRUE;
try {
$fields=array(
'username' => Input::get('username'),
'fname' => Input::get('fname'),
'lname' => Input::get('lname'),
'email' => Input::get('email'),
'password' => password_hash(Input::get('password'), PASSWORD_BCRYPT, array('cost' => 12)),
'permissions' => 1,
'account_owner' => 1,
'stripe_cust_id' => '',
'join_date' => $join_date,
'company' => Input::get('company'),
'email_verified' => 1,
'active' => 1,
'vericode' => 111111,
);
$db->insert('users',$fields);
$theNewId=$db->lastId();
$addNewPermission = array('user_id' => $theNewId, 'permission_id' => $perm);
$db->insert('user_permission_matches',$addNewPermission);
} catch (Exception $e) {
die($e->getMessage());
}
}else{
$val_err = display_errors($validation->errors());
}`
notice above yours won't have the else statement, so add that into your file, now further down the page find the add new users form add replace:
if (!$form_valid && Input::exists()){
echo display_errors($validation->errors());
}`
with:
this should fix it, see below:
`if($validation->passed()) {
$form_valid = TRUE;
try {
$fields=array(
'username' => Input::get('username'),
'fname' => Input::get('fname'),
'lname' => Input::get('lname'),
'email' => Input::get('email'),
'password' => password_hash(Input::get('password'), PASSWORD_BCRYPT, array('cost' => 12)),
'permissions' => 1,
'account_owner' => 1,
'stripe_cust_id' => '',
'join_date' => $join_date,
'company' => Input::get('company'),
'email_verified' => 1,
'active' => 1,
'vericode' => 111111,
);
$db->insert('users',$fields);
$theNewId=$db->lastId();
$addNewPermission = array('user_id' => $theNewId, 'permission_id' => $perm);
$db->insert('user_permission_matches',$addNewPermission);
} catch (Exception $e) {
die($e->getMessage());
}
}else{
$val_err = display_errors($validation->errors());
}`
notice above yours won't have the else statement, so add that into your file, now further down the page find the add new users form add replace:
if (!$form_valid && Input::exists()){
echo display_errors($validation->errors());
}`
with:
Code:
echo $val_err;
this should fix it, see below:
![[Image: Screen%7B3bc1fe685386cc4c3ab89a3f76566d893....33.02.png]](https://dl.dropboxusercontent.com/u/36759429/Screen%7B3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d%7D20Shot%7B3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d%7D202016-08-24%7B3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d%7D20at%7B3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d%7D2017.33.02.png)