Update user blueprint based on site edits

Hi,
What I want to do may be impossible, in which case I would welcome any thoughts on how to implement it a different way in Kirby.

I am setting up an online training site, where users sign up to go through a training course. This will only ever have a small number of users (maybe 100 absolute maximum), so don’t want to branch out into data storage outside Kirby if I can help it.

I have finished setting up the user registration process, thanks to some help on this forum. I have also set up how the course details will be input by the client. It is split into main “Blocks” (for which I am using pages), within which there are any number of “Key Tasks” containing any number of “Task Elements” (for which I have used a nested structure on each page, with simple text fields at both levels).

Now is the bit I am stuck on. I would like, whenever the client adds or edits a Block / Key Task / Task Element, for this to update the student user’s blueprint. It should create the Block as a tab in the user blueprint, the Key Task as a headline and then the Task Elements as select elements with Incomplete / Pending / Complete as the options. This would then allow the client to update these depending on the student’s progress through the course.

This may make no sense at all, but if it does, is this sort of blueprint manipulation possible, or do I need to take a different approach?

So if i understand correctly, you want to update a users content file based on another page being edited to it doesnt need to be entered twice? Im not sure about setting them up as tabs but you can certainly progromataticlly update the content files.

Have a look at hooks page.update:after | Kirby

and $user->update() $user->update() | Kirby

If you do the user update inside the page update hook it will update, however it needs to know the users email address. Im guess you want this to happen to all users at once? you might be able to do it with a loop.

Thanks for the reply!
Updating the content isn’t quite what I am after. It is more updating the blueprint, which is then the method the client will be using to adjust the user’s data.

I guess what I am after is a way to generate something like the following:

blockTwokeyTaskOneElementTwo:
    label: Element Two
    type: select
    options:
      incomplete: Incomplete
      pending: Pending
      complete: Complete

Within my blueprint/users/participant.yml, when the block, key task and element are created or changed on the course pages.

There is no out of the box way to manipulate blueprints. Maybe it would make more sense to use a structure field for this in the user blueprint that can then be updates/added to.

Thanks for that pointer, I will give that a go and see how that works