[SOLVED] CB Auto Actions Renewals on CBSubs

6 years 8 months ago - 6 years 8 months ago #296410 by fede312
Let me see if I understood this correctly.

If the membership gets renewed:

Plan Renewed
Global
Triggers: onCPayUserStateChange
User: Automatic
Access: Everybody
Conditions
1: [var3] Equal To PLAN_ID_HERE
2: [var2] Equal To A
3: [var7] Equal To R
4: [var9_regular_recurrings_used] Equals to 1
Action
Mode: Add Usergroups
Groups: “CB Month 2”

This means that when the “Classroom” Membership Plan
1: [var3] Equal To 1

is active
2: [var2] Equal To A

and the plan gets renewed
3: [var7] Equal To R

and the renewal is the first time that recurs
4: [var9_regular_recurrings_used] Equals to 1

Member ACL Group “CB Month 2” gets added.
Mode: Add Usergroups
Groups: “CB Month 2”

————————————————

Then I supposed I have to create as many "Auto Actions" as I need to recur, with different variables [var9] from Course 1 to lets say 20?

Thanks

Please Log in to join the conversation.

6 years 8 months ago #296417 by krileon
Replied by krileon on topic CB Auto Actions Renewals on CBSubs
Yes, in theory that's how it should work. I however have not tested that usage. Be sure to enable Debug under the Parameters tab of the action and enable debug mode as well as maximum error reporting in Joomla global configuration. This will allow a var_dump to tell you if any of the conditions failed as well as what values they tried to compare.


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 to join the conversation.

6 years 8 months ago - 6 years 8 months ago #296443 by fede312
When the member subscribes to "Community" he gets Assigned to ACL group "Registered"

When the member subscribes to the 1 Month "Classroom" plan
he gets assigned to the ACL Group "Classroom"
and also he gets assigned the 1 month course "CB Month 1" through the following action

Plan Activation
Global
Triggers: onCPayUserStateChange
User: Automatic
Access: Everybody
Conditions
1: [var3] Equal To 1
2: [var2] Equal To A
Action
Mode: Add user groups
Groups: “CB Month 1”

On expiration the ACL Group"Classroom" gets removed
and the ACL Group "CB Month 1" remains active
Just like I wanted. I did not need to use the "Plan Expire Action."

Now for the Renewal

Plan Renewed
Global
Triggers: onCPayUserStateChange
User: Automatic
Access: Everybody
Conditions
1: [var3] Equal To 1
2: [var2] Equal To A
3: [var7] Equal To R
4: [var9_regular_recurrings_used] Equals to 0
Action
Mode: Add Usergroups
Groups: “CB Month 2”

And then the system reactivates the ACL "Classroom" and adds the ACL Group "CB Month 2"

When it gets expired...

Takes out the ACL "Classroom" and keeps the ACL Groups "CB Month1, CB Month 2"

But here is the thing (The system does not register on the database the numbers of the regular recurrings occurred
so the field [regular_recurrings_used] is always 0 in the database.
That is why the action before worked because I did 4: [var9_regular_recurrings_used] Equals to 0

But now I want to add the ACL Group"CB Month 3" on the next renewal, but the [var9_regular_recurrings_used] stays 0 on the database,
so it does not work.

What should I do?

Thank you

Please Log in to join the conversation.

6 years 8 months ago - 6 years 8 months ago #296452 by krileon
How are you renewing? I'm not sure if manual renewals will work. That will also only increment for recurring subscriptions. If you only accept single payments it won't increment that at which point I don't think there's a means of seeing how many times a plan has renewed.

One solution is to just chain the auto actions using the Access parameter. Example as follows.

Action 1
Access: CB Month 3
Groups: CB Month 4

Action 2
Access: CB Month 2
Groups: CB Month 3

Action 3
Access: CB Month 1
Groups: CB Month 2

Action 4
Access: Registered
Groups: CB Month 1

You would still be conditioning this off the renewal of a plan, but remove the var9_regular_recurrings_used condition. This means on each subsequent renewal it adds another stage of the usergroups. It'll skip the action if the usergroup already exists. Note their order being reversed is important. They will execute 1 after another so it's important to reverse the order so they don't just all execute and give all the groups at once.

The only other alternative I can see is to use CB Query Field to count their subscriptions, baskets, or payments for example and then condition against 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.
The following user(s) said Thank You: fede312

Please Log in to join the conversation.

6 years 8 months ago - 6 years 8 months ago #296453 by fede312
Well, I need this to work in both manual subscriptions and recurring (auto renewals)

This is what I'm doing:

I first make a subscription on the front end using the dummy gateway payment.
Then I check if the ACL groups were correctly assigned.

Then I proceed to the PHPMyAdmin database
and on the database table cbsubs_subscriptions.
I edit the fields "subscription_date", "last_renewed_date" and "exiry_date"
I move them all back 1 month and 1 day. That triggers the expiration.

Then I go back to the site user and make sure the ACL permissions were reassigned correctly.

Then I go back to the front end and proceed to renew the subscription, and then repeat the whole process again.

On this way I can check the manual renewal.
But how can I trigger an auto renewal to make sure that works as well?

Also for the manual renewal I thought exactly about the CB Query Field.
So I created I new field on Community Builder ----> Field Management, but I'm not sure how to set it up.

Which of the 2 suggestions will work best for me, and how can I check them to make sure both manual and auto renewals are working correctly?

Thanks

Please Log in to join the conversation.

6 years 8 months ago - 6 years 8 months ago #296454 by krileon
Chaining your actions together using Access or using a CB Query Field to try and figure out the number of renewals are your only options then. Chaning the actions together using Access will be the easiest to setup by far and it'll work regardless of it being a manual or recurring renewal.


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 to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.211 seconds

Facebook Twitter LinkedIn