Reviewed & tested by the community
Project:
Profile
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
10 Sep 2020 at 01:22 UTC
Updated:
20 Dec 2023 at 14:46 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
finnejust sharing a workaround I'm using
Comment #3
chi commentedComment #4
chi commentedComment #5
mglamanI'm not sure how this works. While it is nice re-using our computed entity reference field, it's doing the same thing as the computed field.
https://git.drupalcode.org/project/profile/-/blob/8.x-1.x/src/Plugin/Fie...
Unless somehow the field item list is prepopulated and we're able to fetch them statically?
I'm not sure what this change accomplishes?
Comment #6
chi commentedI was also wondering how computed field fixes the issue. Note that workaround in #2 also relies on it.
The user needs to be created after configuring profile type. See failed patch in #3.
Comment #7
mglamanAh, I see :). That makes sense, because the user object is stale and does not have the computed field reference, yet.
It has to magically work due to the fact the profile form is attached as the field widget. I don't quite understand how, as I read \Drupal\profile\Plugin\Field\FieldWidget\ProfileFormWidget::saveProfiles
But that also shows that the profile has a user ID attached. Which is weird the query call is empty in token.
No idea. It'd be nice to debug \Drupal\profile\Plugin\Field\ProfileEntityFieldItemList::computeValue and get an idea of "how" this works.
Otherwise the fix isn't controversial. We're normalizing how we access profiles for a user by leveraging the computed field.
Comment #8
finneI tested this on a D8.9 installation and it works fine. User profile fields are now available in the registration mails.
Comment #9
loze commented#4 wouldn't apply to the latest dev. here is a reroll
Comment #10
soulreceiver commentedTested this latest patch on a Drupal 9.5.11 instance running Profile 1.7.0 and it works wonderfully!
Comment #11
longwaveWe are using #9 in production to send registration emails containing profile fields and it works great.