Problem/Motivation
I want to create a drupal admin user, but not map them to a CRM contact.
Steps to reproduce
1. Enable user contact mapping.
2. Add a new drupal user, with a role like Content Editor.
3. The user now exists as a CRM contact.
Proposed resolution
Add new permission to override the default behavior. If the user has this permission, they can change the behavior for an individual user at time of creation.
Title
Override user contact mapping
Machine name
override crm user contact mapping
Remaining tasks
User interface changes
Alter the user add form to change the mapping setting for user about to be created.
API changes
Data model changes
Comments
Comment #2
bluegeek9 commentedComment #3
bdanin commentedI think if we had a boolean that said "do not require a contact for this user" (or similar message) that would be useful for our case.
Comment #4
bluegeek9 commentedIs it the creation of the contact that is the issue?
If there was an existing contact with the same email, or other criteria, that matches the user, would you still want the mapping created?
Comment #5
mortona2k commentedIn this scenario, we are adding some admin and developer user accounts to drupal, and do not want contact records for them.
We have these options enabled:

Now any new user will get a crm contact. We would need to turn these settings off and create the contact/mapping another way, which would lose the other helpful mapping settings like showing contact fields on a combined form.
However we don't really need those (telephone/address) when creating these admin/dev accounts anyway, so maybe we should go another way with this?
Comment #6
bluegeek9 commentedWhat permission should the user need to see the checkbox on the add user form, to not create a contact?
Comment #7
mortona2k commentedI think we may need a different approach for our project instead of using a global setting like this.
In our case, members can log in and access parts of the site, like news and voting.
Contacts are primarily added when they participate in evaluation events. When they pass the evaluation and become certified, they have the option to become members and would get a user account at that time.
Comment #8
bluegeek9 commentedThis sounds like two features.
The SMTP project uses config overrides for their test form.
https://git.drupalcode.org/project/smtp/-/blob/8.x-1.x/src/Form/TestForm...
https://git.drupalcode.org/project/smtp/-/blob/8.x-1.x/src/Config/SmtpOv...
Comment #9
mortona2k commentedMaybe this is too broad of a rule to implement at the root level?
An application developer may want a certain form to save a contact and linked user.
Having an all or nothing rule seems pretty heavy handed.
Comment #10
bluegeek9 commentedIt sounds like option #2 is what you are looking for. The SMTP module is able to send test emails even when it is not the default mail plugin. It uses a programmatic Override. The same can be done for add user form.
Comment #11
bluegeek9 commentedUse a dedicated CRM permission:
Title
Override user contact mapping
Machine name
override crm user contact mapping
Comment #12
bluegeek9 commentedComment #13
bluegeek9 commentedComment #15
bluegeek9 commentedThis is a work in progress. It works, but needs polish.
Comment #16
bluegeek9 commentedComment #18
bluegeek9 commented