Option to prepopulate Node Author

Created on 23 June 2020, almost 5 years ago
Updated 18 July 2024, 9 months ago

I need to prepopulate the node author property on a node creation form and tested this like that:

- http://www.example.com/node/add/page?edit[author][widget][0][target_id]=190

That didn't work. Looking forward for this as a feature request.

Feature request
Status

Active

Version

2.0

Component

Code

Created by

🇩🇪Germany marco.b

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇭🇺Hungary Sweetchuck Budapest

    The reason it does not work with node:uid is that,
    perepopulate field values from query string only works when the field has no default value.
    "Entity owner" field usually has a default value (current user), because of the BaseFieldDefinition::setDefaultValueCallback().

    Non empty fields can't be overridden from query strings.
    See Populate::populateForm().

    When I temporally remove that condition and I use this query string ?edit[uid][widget][0][target_id]=42 then it looks good in the node create form. I did not press the "Save" button.

    I hope this information helps you to find a custom solution/workaround.

    In my use case, I would like to make it easier for administrators to create a node for somebody else. They already have access to the "Authored by" field, just make sure they don't forget to change it.

Production build 0.71.5 2024