Question

I am new to open atrium and Drupal and I am building a new site to manage volunteers. I have about 200 fields to add to my users' profiles (So new fields below password, picture, display name, etc...)

Doing this from the Administration » Configuration » People » Account parameters panel will be a cumbersome process so I want to avoid it and instead use a script to create all my fields. This is the best approach because all those fields are very similar, they are there to store multiple integer values for all days within 5 weeks (Notably catering information : number of meals for morning/noon/evening)

After a few researches, I found this module which seems to do exactly what I want : Bulk Creator

The issue is that I don't really understand how I can specify that the fields I want to add are related to user profile. The only way I can think off is to specify it in the content_type parameter, however I can't find any content type related to users in the configuration.

Any other solution to batch create my hundreds of user fields is welcome. I've thrown an eye to the DB tables in order to do it using SQL instructions, but I quickly understood that it was not a good idea :)

Was it helpful?

Solution

Rather than creating 200 fields on one entity (this will definitely slow down Drupal), you could group the repeating fields using field collections.

Since you mention there are several fields per day, I'd combine all similar fields into a collection.

So start of with the user and add a field collection field which you name 'weeks' or something and configure it to take 5 values (one for each week).

Now edit the newly created field collection (admin > structure > field collections) and add a new field collection which you name 'days'. This field can contain 7 values.

Again, edit the created field collection and add all fields you need for one day. So one field for the room, one for the amount of breakfasts, etc.

You now have a structure like this:

User 
  - 5 week field collection
    - 7 days field collection
      - room
      - # of breakfasts
      - ...

This is structure you can create by hand it would be about 10 fields.

Reading and printing the data can be easy done with views, but there are quite some tutorials out there already. If you can't figure it out, feel free to ask a new question.

Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange
scroll top