- Issue created by @coaston
- π©πͺGermany jurgenhaas Gottmadingen
I'm moving this into the ECA Commerce integration module.
There might be a couple of options on how to resolve this:
- If the subscription module dispatches an event when a subscription expires, then ECA can listen to that event and do the role assignment logic.
- Otherwise, you could probably write a view which lists you all expired subscriptions, and then you could remove the role for each of those.
- πΈπ°Slovakia coaston
#jurgenhaas Thank you
The idea with a view is quite good. I started but need help to finish it.
1. Created a view with commerce subcription type
2. Added filter to state active and trial
3. Contextual filter to current user
4. Display only 1 rowSo if user has multiple subscribtions for me it is good enough there is at least one active and if not the view result is blank so i would say my view is ready.
Now i need to use ECA but not sure how to check if result of view has any result. If there is any - assign user with premium role. If the view is blank = remove premium role. I can comfigure cron but not sure about views.
I have tried this example with no luck :
View model - π©πͺGermany jurgenhaas Gottmadingen
That sample model is quite a good one. You can probably enhance it by using the condition to see how many items are in a list to see if the result is empty or not. There is also another example model at https://ecaguide.org/library/use%20case/eca_feature_demo/ which shows how to add or remove roles from users.
Then, if the model doesn't work as expected, then the debugging techniques described in https://ecaguide.org/eca/debugging/ should help you to find out where it goes wrong.
- πΈπ°Slovakia coaston
Thank you. I was able to complete this with condition to check the count of rows. So now it seems it works as expected.
Before I close this issue, just wondering if it is possible to limit users to only be able to register one account from the same IP address with ECA?
- Status changed to Fixed
over 1 year ago 6:31am 27 July 2023 - π©πͺGermany jurgenhaas Gottmadingen
Thanks for your feedback.
As for the second question, this qualifies for a new issue, but in the ECA queue. It then also helps other users find it when they ever come along to a similar question.
Automatically closed - issue fixed for 2 weeks with no activity.