Attach existing contacts to new users created outside registration

Created on 17 March 2021, over 3 years ago
Updated 6 March 2024, 4 months ago

Problem/Motivation

Tools like command-line drupal creation or any other code-based user generation bypass the registration forms, and thus also bypass the code that connects existing contacts and new users based on email address. Automated testing, for example.

Steps to reproduce

Install redhen, enable contact/user connection options on the redhen contact config page. Create a contact with a specific email address, but no user. Use Drupal command line to generate a user (drupal user:create) with the same email address. You'll have both in the system, but they won't be connected.

Proposed resolution

Hook into user creation.

✨ Feature request
Status

Needs work

Version

2.1

Component

Shared

Created by

πŸ‡ΊπŸ‡ΈUnited States gcb

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

Merge Requests

Comments & Activities

Not all content is available!

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

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

    Parallel issue: Contacts don't exist when a user registration email is sent, meaning tokens aren't available yet. Attached patch fixes both these issues with a refactor to how we handle registration.

    This probably needs some more work to line up all the settings. We currently have a setting "Link to existing contacts" that essentially does nothing. This patch acts as if it is always turned on when user/contact connection is active -- so the setting is still useless.

    However, this patch is necessary for the basic version of "create contact on registration" now, so we can't simply base this behavior on the Link to Existing setting.

  • Status changed to Needs work 9 months ago
  • πŸ‡ΊπŸ‡ΈUnited States mariacha1

    This feels more like an entirely new behavior, and a new checkbox would have better backwards compatibility too, in case people are somehow counting on there not being a connection between users and redhen contacts when the user is created programmatically.

    Maybe a new setting "Connect RedHen contacts to new users": "Will attempt to connect Drupal users to RedHen contacts by matching email addresses whenever a user is created."

    And, as you've noted, the "registration_link" aka "Link to existing contacts" is not used at all, so it could be taken off the settings form in the "Registration" section, and the new checkbox could replace it (but not be in the "Registration" field group).

  • Assigned to mariacha1
  • πŸ‡ΊπŸ‡ΈUnited States gcb

    Thanks for the feedback @mariacha1. How about now? I went ahead and added a schema file for the Contact settings as well.

  • Assigned to gcb
  • πŸ‡ΊπŸ‡ΈUnited States mariacha1
Production build 0.69.0 2024