Support load user entity by name process callback

Created on 6 May 2017, over 7 years ago
Updated 17 October 2023, about 1 year ago

Problem/Motivation

Unless a user already exists in a site import, which precludes the use case of installing content into an empty database, the UID is unknown at the time of content definition. Support needs to be added to reference users for author assignment using identifiers known or assignable at the time of defining content in the import files.

Proposed resolution

Add an event subscriber to process Node imports and assign authors with additional processing to expand support of identifiers to the following:

  • UID
  • UUID
  • User Name

API changes

Nodes in import content may be assigned authors by defining a UID, UUID, or user name in the Node's uid attribute using the following format:

- entity: node
  type: article
  uid: <user_id>|<uuid>|<username>
✨ Feature request
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States jasonawant New Orleans, USA

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

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.

  • Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update about 1 year ago
    Waiting for branch to pass
  • πŸ‡΅πŸ‡ͺPeru marvil07

    Quite useful extension, thanks!

    It is not applying anymore, here a re-roll for current 8.x-1.x, at 8.x-1.0-alpha9.

  • Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update about 1 year ago
    Waiting for branch to pass
  • πŸ‡΅πŸ‡ͺPeru marvil07

    Here an alternative patch, generalizing to apply it not only to Node entities, but any EntityOwnerInterface.
    This is useful on entities like profile module entities, that are not nodes but have ownership.
    Additionally, an interdiff, via git for easier read on the rename.

Production build 0.71.5 2024