+ $user_id = ttUserHelper::insert($fields);
+ if ($user_id) {
+ if (!$user->exists()) {
+ // We added a user to an empty subgroup. Set new user as on behalf user.
+ // Needed for user-based things to work (such as notifications config).
+ $user->setOnBehalfUser($user_id);
+ }