- Issue created by @yurg
- π©πͺGermany jurgenhaas Gottmadingen
This sounds like a permission issue: the current user (the one who purchases the membership) does not have the permission to add themselves to the group. See https://git.drupalcode.org/project/group_action/-/blob/1.0.x/src/Plugin/...
Your model will probably have to switch the user to a more privileged one to perform this action.
Perhaps it worth mentioning the eca_base modeller is being used: at this stage all this BPMN stuff looks too scary to dive into for someone familiar with Drupal 7 Rules.
Don't worry, there is nothing scary about BPMN. In fact, it is so much more efficient in building and reviewing models. That's certainly what we hear from all users who originally had similar reservations.
- πΈπ°Slovakia yurg
@jurgenhaas Thank you for your note! We've been trying to escalate permissions by user switch - should have been easy since a Store owner and a Group creator is the same UID ([commerce_order:store_id:entity:uid] in our case).
Wrong Successors perhaps?uuid: fa4067bd-f1ab-474e-84bb-213925c3ca6c langcode: en status: true dependencies: module: - eca_commerce - eca_user - group_action id: newordertagall modeller: core label: 'Add customer to a Group' version: '' weight: -10 events: eca_commerce_order_create: plugin: 'eca_commerce:order_create' label: 'Order: Create' configuration: { } successors: - id: eca_switch_account condition: null - id: group_add_member condition: null conditions: { } gateways: { } actions: eca_switch_account: plugin: eca_switch_account label: 'User: switch current account' configuration: user_id: '[commerce_order:store_id:entity:uid]' successors: - id: group_add_member condition: null group_add_member: plugin: group_add_member label: 'Group: add customer as member' configuration: values: { } operation: create content_plugin: group_membership group_id: '[commerce_order:store_id:entity:field_group_reference:id]' entity_id: '' add_method: skip_existing object: '[commerce_order:uid:entity]' replace_tokens: false successors: { }
- π©πͺGermany jurgenhaas Gottmadingen
I can't verify all the tokens, but
commerce_order:store_id:entity:uid
is probably not giving you what you think. You could either try with a fixed id 1 to see if superpowers is solving the issue. If even that doesn't work, you may want to move this issue over to the group action module to find out why the access check on that action is failing. - πΈπ°Slovakia yurg
@jurgenhaas Thank you, it's tokens issue indeed and it should be a [simple] matter of retrieving proper IDs from orders and filling the correct combination of Group ID / UUID, Entity ID / UUID and Entity fields. And finding out why would a member be added twice ( have tried with hard-coded tokens already ).
- πΈπ°Slovakia yurg
Well then, it's all about Tokens indeed: have had to use Rules token chaining to get right ones.
Here is the list in case someone needs it, basically, we add the "target_id" everywhere:- Customer UID: [commerce_order:uid:target_id]
Makes sense for logged-in user only.- Store ID: [commerce_order:store_id:target_id]
ID of a Store the purchased product belongs to.- Store owner ID: [commerce_order:store_id:entity:uid:target_id]
- Group ID: [commerce_order:store_id:entity:field_group_reference:target_id]
field_group_reference here is a name of your Store Entity Reference field, referencing Groups.
Same should work for the other reference fields. - Assigned to yurg
- Status changed to Fixed
8 months ago 12:45pm 30 April 2024 Automatically closed - issue fixed for 2 weeks with no activity.