You could do it with a script resolver, which is essentially a snippet that runs during the install.
In theory, you could create the users and user groups in the same way you create elements and resources and add everything in build.transport.php, but TBH, unless you have a whole lot of users, I think it would easier to just do it all in a resolver.
There's an example of a Resolver in the MyComponent/getMyComponent package, but I wouldn't recommend using that package at this point, because I'm currently refactoring it from the ground up.
A script resolver looks like this (it could go in a file: _build/resolvers/install.script.php):
<?php
if ($object->xpdo) {
$modx =& $object->xpdo;
switch ($options[xPDOTransport::PACKAGE_ACTION]) {
case xPDOTransport::ACTION_INSTALL:
case xPDOTransport::ACTION_UPGRADE:
/* your code here */
break;
case xPDOTransport::ACTION_UNINSTALL
/* Your code here */
break;:
}
}
return true;
In build.transport.php, you need this code to add the resolver (at some point where $vehicle exists):
$modx->log(modX::LOG_LEVEL_INFO,'Adding in Script Resolver.');
$vehicle->resolve('php',array(
'source' => $sources['resolvers'] . 'install.script.php',
));
BTW, this is a great place to see how to do stuff in a Transport Package:
https://github.com/splittingred
------------------------------------------------------------------------------------------
PLEASE, PLEASE specify the version of MODX you are using.
MODX info for everyone:
http://bobsguides.com/modx.html