Rename CRM User to be more clear

Created on 19 May 2025, about 2 months ago

Problem/Motivation

The name "CRM User" doesn't convey what it represents: a mapping between a CRM Contact and Drupal core's User.

Proposed resolution

Rename it. Examples:

  • id (and base_table) "crm_user" to "crm_contact_user"
  • label "CRM User" to "Contact User Mapping" (or "CRM Contact User Mapping")
  • class name "User" to "ContactUser"

Remaining tasks

User interface changes

API changes

Data model changes

πŸ“Œ Task
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States jdleonard Austin, TX, USA

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

Merge Requests

Comments & Activities

  • Issue created by @jdleonard
  • πŸ‡ΊπŸ‡ΈUnited States bluegeek9
  • πŸ‡ΊπŸ‡ΈUnited States jdleonard Austin, TX, USA

    Good change!

  • haritha c β†’ made their first commit to this issue’s fork.

  • Merge request !29Filename update β†’ (Merged) created by Unnamed author
  • Merge request !30updated the label and file names β†’ (Closed) created by Unnamed author
  • Pipeline finished with Failed
    about 2 months ago
    Total: 280s
    #501409
  • Pipeline finished with Failed
    about 2 months ago
    #501408
  • πŸ‡ΊπŸ‡ΈUnited States jdleonard Austin, TX, USA

    Haritha, thanks for your contribution. Please close one MR and focus on just one MR/branch.

    There remain many references in the project to crm_user_contact, "CRM User", etc. These all need to reflect the name change. This should help get the tests passing.

  • Pipeline finished with Success
    about 2 months ago
    Total: 320s
    #502480
  • Pipeline finished with Success
    about 2 months ago
    Total: 381s
    #502487
  • Hi @jdleonard, Thank you for your guidance. I have updated all references from `crm_user` to `crm_user_contact` across the codebase and resolved the pipeline issues. The changes are included in MR !29. Please review MR !29. If any further changes are required, please let me know.

  • πŸ‡ΊπŸ‡ΈUnited States jdleonard Austin, TX, USA

    Thanks Haritha.

    Please "close" MR 30 to avoid confusion.

    I have not performed a detailed review, but here are some outstanding needs.

    For the remaining MR, please note items 2 and 4 from Creating Merge Requests β†’ .

    Classes such as CrmUserEvent and CrmUserInterface need renaming.

    Variables such as `crm_user` and `$crm_user_storage` need renaming.

    Any use of "Contact User" should be "User Contact". I updated the issue summary to remove a contradiction that may have introduced this.

    It would also be helpful to hear what steps you took to test that the relevant features continue to function.

  • Pipeline finished with Failed
    about 2 months ago
    Total: 279s
    #502514
  • Pipeline finished with Success
    about 1 month ago
    Total: 409s
    #503523
  • @jdleonard, thank you for your feedback in comment #9.
    I’ve updated MR !29 with all requested fixes:
    Closed MR !30: Closed to consolidate changes in MR !29.
    Renamed Classes:
    CrmUserEvent to CrmUserContactEvent in src/Event/CrmUserEvent.php.
    CrmUserInterface to CrmUserContactInterface (or clarified its usage).
    Renamed Variables:
    Updated crm_user, $crm_user_storage to crm_user_contact, $crm_user_contact_storage in crm.module, crm.install, etc.
    Corrected Terminology:
    Replaced "Contact User" with "User Contact" in crm.schema.yml, Views, and labels.
    Cleaned References:
    Used grep -r "crm_user" . and grep -r "CrmUser" . to update all instances to crm_user_contact and CrmUserContact.

    Testing Steps: In my local Drupal environment (/d/xampp/htdocs/DrupalContribution):
    Installed the module (drush en crm, drush cr).
    Configured auto_create_crm_user_contact at /admin/config/crm/user/settings and verified the form.
    Checked /admin/config/crm/user for correct CrmUserContact entity display (id, user, crm_contact).
    Created a user at /admin/people/create and confirmed automatic CrmUserContact creation.
    Tested add/edit/delete at /admin/config/crm/user/add, /admin/config/crm/user/[id]/edit, /admin/config/crm/user/[id]/delete.
    Verified user deletion removes CrmUserContact entities.
    Confirmed name formatting on user profiles (/user/[uid]).
    Checked permissions at /admin/people/permissions for CRM access.

    All features work as expected, and pipeline issues are resolved. Please review MR !29. Let me know if further changes are needed!

  • πŸ‡ΊπŸ‡ΈUnited States jdleonard Austin, TX, USA

    /admin/config/crm/user/list

    Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'db.crm_user' doesn't exist: SELECT COUNT(*) FROM "crm_user"; Array ( ) in Drupal\crm\UserListBuilder->render() (line 79 of /var/www/html/local_projects/crm/src/UserListBuilder.php).

    UserListBuilder::render references the crm_user database table, which has changed.

    UserListBuilder, UserStorageSchema, UserViewBuilder, UserForm should also be renamed.

  • πŸ‡ΊπŸ‡ΈUnited States bluegeek9

    bluegeek9 β†’ changed the visibility of the branch 1.0.x to hidden.

  • Pipeline finished with Success
    about 1 month ago
    Total: 375s
    #506435
  • @jdleonard
    Fixed the DB issue by correcting the reference (was crm_user).
    Could you confirm the new entity name for class renaming?
    Would CrmUser or CustomerUser work, or is there a preferred naming convention?

  • πŸ‡ΊπŸ‡ΈUnited States jdleonard Austin, TX, USA

    Everything "User" should become "UserContact" e.g. "UserListBuilder" should become "UserContactListBuilder". Thanks!

  • πŸ‡ΊπŸ‡ΈUnited States bluegeek9
  • πŸ‡ΊπŸ‡ΈUnited States bluegeek9
  • Pipeline finished with Skipped
    23 days ago
    #521068
  • πŸ‡ΊπŸ‡ΈUnited States bluegeek9
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024