| 10:17 | karna[m] | Hey Mike, can you suggest how I go about batch adding users who I'm migrating over from our old site? I have usernames and emails and can randomly generate passwords which will be e-mailed out to them |
| 10:17 | karna[m] | I would then like to use the quick form I've created/modified to add assets for and attribute to them to a specific area which I will point to co-ordinates derived from the postcode data I have and allow users to geometrically plot their growing space |
| 10:22 | karna[m] | I'm thinking I reconfigure my modular quick form such that it allows the creation of new users in it too and then run a script to batch add all of my people/asset/area data. The only thing I'm unsure about is how I go about attributing assets/areas to a person |
| 10:22 | karna[m] | like how I can have the form handle that |
| 12:51 | mstenta[m] | karna: You might want to look into Drush |
| 12:51 | mstenta[m] | www.drush.org/ |
| 12:51 | mstenta[m] | It is a command line utility for Drupal |
| 12:52 | mstenta[m] | One of the commands/tools it comes with allows you to run an arbitrary PHP script from the command line |
| 12:52 | mstenta[m] | So you could create a script that creates all your users, called create-users.php |
| 12:52 | mstenta[m] | Then run `drush php-script create-users.php` |
| 12:53 | mstenta[m] | And it will run the script in a fully-bootstrapped Drupal context (so you have access to all Drupal functions, database, etc) |
| 12:53 | mstenta[m] | > The only thing I'm unsure about is how I go about attributing assets/areas to a person |
| 12:53 | mstenta[m] | As for this (attributing assets/areas to a person)... |
| 12:54 | mstenta[m] | farmOS does have a user ID column in the {farm_asset} database table |
| 12:54 | mstenta[m] | Currently that is not used/displayed anywhere in farmOS - but it does automatically store the user ID of the person who created the asset |
| 12:55 | mstenta[m] | Areas, on the other hand, do not have any way of being assigned to a particular person currently |
| 12:55 | mstenta[m] | This is something that's come up before, though - so we should open a feature request for it and discuss |
| 12:55 | mstenta[m] | In the meantime, you could consider adding your own database table via a custom module, which maintains an association between areas and users |
| 12:56 | mstenta[m] | Check out Drupal's hook_schema() for adding database tables: api.drupal.org/api/drupal/modules%21syst |
| 15:52 | mstenta[m] | FYI: twitter.com/farmOSorg/status/11457213878 |
| 20:25 | * | JustTB has joined |
| 21:55 | karna[m] | mstenta: nice one Mike, thanks for laying it out the steps so clearly for me ^_^ will get to work on it tomorrow |
| 22:01 | mstenta[m] | Sure thing! Good luck @karna:matrix.org |