diff --git a/app/sprinkles/admin/src/Controller/UserController.php b/app/sprinkles/admin/src/Controller/UserController.php index 1acf4af06..15a2f99bc 100644 --- a/app/sprinkles/admin/src/Controller/UserController.php +++ b/app/sprinkles/admin/src/Controller/UserController.php @@ -136,6 +136,11 @@ public function create(Request $request, Response $response, array $args) $data['group_id'] = $currentUser->group_id; } + // 0 maps to "No group", database requires a NULL to avoid issues with foreign keys + if (isset($data['group_id']) && $data['group_id'] == 0) { + $data['group_id'] = null; + } + $data['flag_verified'] = 1; if (!isset($data['password'])) { // Set password as empty on initial creation. We will then send email so new user can set it themselves via a verification token