You’d need to create a custom hook for FormIt.
Here’s something similar that should get you started:
<?php
/* Create a user group (if the group already exists you'd use getObject() instead) */
$group = $modx->newObject('modUserGroup',array('name'=>'PhotoEditors'));
$group ->save();
/* create a user */
$user = $modx->newObject('modUser', array('username'=>'BillSmith'));
$profile = $modx->newObject('modUserProfile');
$profile->set('fullname','Bill Smith');
$profile->set('email','[email protected]');
$user->addOne($profile);
/* create a role (if the role already exists, you'd use getObject() instead) */
$role = $modx->newObject('modUserGroupRole', array('name'=>'PhotoEditor','authority'=>'7'));
/* add the user to the group with the role above*/
$intersect = $modx->newObject('modUserGroupMember');
$intersect->addOne($user);
$intersect->addOne($group);
$intersect->addOne($role);
$modx->beginTransaction();
if (! $intersect->save()) {
$modx->rollback();
$output .= 'An error occurred — user, role, and group not saved';
} else {
$modx->commit();
$output .= 'User, role, and Group Created';
}
You’d have to replace the literal strings with variables you get from the form submission or parameters. You’d probably want to try getObject() first and create the object if it returns null.