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: