Skip to Content Skip to Menu

onCPayUserStateChange is firing before CB Fields integration

  • joomally
  • joomally
  • OFFLINE
  • Posts: 104
  • Thanks: 8
  • Karma: 1
4 years 2 weeks ago #321241 by joomally
I have a few plans that are non-exclusive. I want to treat the plans as a group and just be informed when someone enters or leaves the group of plans.

ie I would like to receive an email when someone who is not in any of this particular group of plans signs up to any plan in the group.
I would also like to receive an email when someone expires/cancels one of these plans and they are not subscribed to any of the other plans in the group.


I thought that I could do this with CB Auto Actions.
I created a field for each plan, and used CB Fields Integrations to assign/remove the field for each plan.

The CB Fields Integration is working ok.

But I think that the CB Auto Action trigger onCPayUserStateChange is firing before the CB Fields integration is setting the field values.

So, the CB Auto Actions conditions are not being met.

Is there any way to use CB Auto Actions to do this ?

Thanks

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
4 years 2 weeks ago #321247 by krileon
You shouldn't need CB Auto Actions for that. CBSubs Emails lets you create custom emails on subscription state changes.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • joomally
  • joomally
  • OFFLINE
  • Posts: 104
  • Thanks: 8
  • Karma: 1
4 years 2 weeks ago - 4 years 2 weeks ago #321256 by joomally
I was hoping that this situation would trigger some other actions of CB Auto Actions, as well.
Is it possible to set up a CB Auto Action to be triggered by the situation above ?
Thanks
Last edit: 4 years 2 weeks ago by joomally.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
4 years 2 weeks ago #321262 by krileon
CB Auto Actions can act on subscription status changes, yes. This is done using the below.

Plan Active
Global
Triggers: onCPayUserStateChange
User: Automatic
Access: Everybody
Conditions (custom value conditions)
1: [var3] Equal To PLAN_ID_HERE
2: [var2] Equal To A

Plan Expired
Global
Triggers: onCPayUserStateChange
User: Automatic
Access: Everybody
Conditions (custom value conditions)
1: [var3] Equal To PLAN_ID_HERE
2: [var2] Not Equal To A

[var2] is the status the subscription is being changed to. The available values for [var2] are as follows.

A = Active
R = Registered Unpaid
X = Expired
C = Unsubscribed
U = Upgraded to other
I = Invalid


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • joomally
  • joomally
  • OFFLINE
  • Posts: 104
  • Thanks: 8
  • Karma: 1
4 years 2 weeks ago #321269 by joomally
Thanks.
My case is a little bit more complicated than just needing to be triggered when the status of one subscription changes. I also want to consider whether they have valid subscriptions for certain other plans.
Is it possible to use the existence of a subscription as a condition for the CB Auto Action, too ?

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
4 years 2 weeks ago #321278 by krileon

Is it possible to use the existence of a subscription as a condition for the CB Auto Action, too ?

Yes, but you'll have to code that. Latest CB Auto Actions release lets you create Code and Query conditions for auto actions. So you can condition against custom PHP or a custom database query. That information isn't relevant to the onCPayUserStateChange trigger so custom coding that condition is the only way to do that.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum