thrownewAppException('Enter a valid username, first/last name, email and role.');
$db=$this->connect();
$stmt=$db->prepare('SELECT user_serial FROM users WHERE user_name IN (?,?) OR user_email IN (?,?)');
$stmt->execute([$name,$email,$email,$name]);
if($stmt->fetch())
thrownewAppException('An account already uses those details. Use the existing account or resend its invitation.',409);
$db->beginTransaction();
try{
$stmt=$db->prepare("INSERT INTO users(user_name,user_first_name,user_last_name,user_email,user_password_hash,user_role,user_status,user_change_password,user_creator) VALUES(?,?,?,?,?,?,'active',1,?)");