Skip to Content Skip to Menu

Using Auto Actions to update usergroup when the sub is using Plan Options

  • wintercorn
  • wintercorn
  • ONLINE
  • Posts: 208
  • Thanks: 21
  • Karma: 2
6 hours 4 minutes ago #343755 by wintercorn
As part of the process to slim down the registration process I've used a single sub plan with options instead of individual subs. Issue is now that new users don't get allocated to their respective usergroups which are used for content access etc.

How can I user Auto Actions to assign the correct usergroup to each new user if I'm using Plan Options?

Thanks

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 50347
  • Thanks: 8619
  • Karma: 1472
5 hours 19 minutes ago #343760 by krileon
Selected options are pushed into the basket and the subscription parameters for easy extraction. So you'll be able to get their option selection from there to use in CB Auto Actions. Below is an example of this.

Plan Active
Global
Triggers: onCPayUserStateChange
User: Automatic
Access: Everybody
Conditions
Condition 1
Field: Custom > Value
Custom Value: [var3]
Operator: Equal To
Value: PLAN_ID_HERE
Condition 2
Field: Custom > Value
Custom Value: [var2]
Operator: Equal To
Value: A
Condition 3
Field: Custom > Value
Custom Value: [var9_integrations_planoptions_PLAN_OPTION_NAME_HERE]
Operator: Does Contain
Value: OPTION_VALUE_HERE

Plan Expired
Global
Triggers: onCPayUserStateChange
User: Automatic
Access: Everybody
Conditions
Condition 1
Field: Custom > Value
Custom Value: [var3]
Operator: Equal To
Value: PLAN_ID_HERE
Condition 2
Field: Custom > Value
Custom Value: [var2]
Operator: Not Equal To
Value: A
Condition 3
Field: Custom > Value
Custom Value: [var9_integrations_planoptions_PLAN_OPTION_NAME_HERE]
Operator: Equal To
Value: OPTION_VALUE_HERE

This will work with any action type. So if you want to add/remove usergroups you'd use a Usergroup action. var9 in this example is the subscription object. So it contains all the information for the subscription row in _cbsubs_subscriptions. CB Auto Actions should be allowed to go that deep on nested parameters, but if not will review patching in further object depth. It's also possible to do the conditional check using PHP if the substitution gives trouble so let me know if that doesn't work for you.

Replace PLAN_ID_HERE with the ID of the plan you want this to act on. Replace PLAN_OPTION_NAME_HERE with the "Name" of your option. Replace OPTION_VALUE_HERE with the value of one of the options values.


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