- Issue created by @martin@manarock.co.uk
Hi Folks,
I am currently trying to perform some actions with the ECA module, and Profile.
I am hoping to learn 'how' to answer these (or similar) queries, as opposed to just finding out the answer!
Problem Statement:
As a sitebuilder, I would like to check for existence of a profile of a given type for the logged in user at the point of the users login.
I would like to do this to create the profile and perform distinct actions if the profile does not exist, or query the value of a given field within the profile if it does.
Aiming to do this with EAC, I belive I need to check all of the profiles for a user, and look for a profile entity that matches the type in question. This is done by tokenizing a value and using the token to perform a logical check.
Form looking at the module, and reading around it seems that the profile module creates a profile entity and adds base fields that contain a relationship to each profile.
It appears that in php you would access these as follows:
$profiles = $user->get($profile_type_id . '_profiles)->referencedEntities();
In EAC in the task to 'token set value', you have to load a value called by a replacement pattern- I am trying [user:profile_type_id]
1) How can I tell if this is correct, or in the correct format/syntax to access the data listing all of the profiles associated with the user?
I then have to load the value from my token one by one to check them in the entity load action, specifying the entity and entity ID.
2) I can select 'Profile' as an Entity type in the dropdown, but then have to specific the Entity ID. I believe this is set per install? How can I find the entity ID I need?
note: in an example with a taxonomy entity, the replacement pattern [item:target_id] is correct. Is this Taxonomy specific, or should this work for Profile?
Thanks in advance! If anyone has a worked example using EAC and Profile it would be greatly appreciated :)
Further details are here (https://drupal.slack.com/archives/C0287U62CSG/p1681320637838689?thread_t...), beyond the summary above if helpful.
Active
1.0
Documentation