Janitor plugin: may I get data from a user blueprint?


poke @bnomei

I try to get user id in a Janitor jobs to update user page fields when clicking on a Janitor button, but $data return an empty String.

May we get data from a user blueprint and pass it to a Janitor job?

This is my code:


          type: janitor
           label: Modifications du journaliste contrôlées
           icon: smile
           job: updateJournalistValidated
           data: '{{ user.id }}'
                       journalistState: update


'updateJournalistValidated' => function (Kirby\Cms\Page $page = null, string $data = null ) {
            $kirby = kirby();
            $journalist = $kirby->user( $data );
            if ( !empty( $journalist ) ) :
                    'journalistState'  => '',
                    'updateJournalistValidatedInfo' => '',
            return [
                'status'    => 200,
                'reload'    => true,

Thanks for any help :slight_smile:

From looking at the source code, the data property only works for page and file models, not for users.

Maybe create a feature request for user support (or extend it yourself for the time being)

1 Like

Thanks @texnixe for this confirmation. I’m going to suggest to Bruno an enhancement in its Github repo.

quick hack… might work. i have no time to test it today.