[SOLVED] CBSubs: CB Fields integration not working on deactivation

8 years 2 months ago - 8 years 2 months ago #278492 by lousyfool
Hi,

I saw a post on this from almost 6 months ago here , to which Kyle responded that he created a bug ticket for it.

But I'm still experiencing the same issue with
CB 2.0.13+build.2016.02.16.21.47.49.80a7a7bf2
CBSubs nightly build 4.0.1.ci.2016.01.20.00.20

I'm having a CB field "cb_paa" as Checkbox (Single), which should have a value of 1 if the user has an active subscription for a specific plan, and 0 if not.

In the plan it's configured as per attached screenshot.
It works perfectly fine on plan activation, the field value gets set to 1.
But no joy on plan deactivation, the field value remains to be 1 and does not get set to 0.

Admittedly, I haven't tried all possible scenarios of plan deactivation, but I'm absolutely sure that it does not work if a plan gets unsubscribed from in the frontend, or deleted or unsubscribed from in the subscription tab for the user in the backend.

I think we should expect it to work just as complete and well as the ACL/Usergroup changes in the Access tab of plans, which seems absolutely reliable no matter what causes plan activation/deactivation. So, maybe there is a bug in the CB Fields Integration of CBSubs, still?

Thanks for taking care of it.
Attachments:

Please Log in to join the conversation.

8 years 2 months ago #278501 by sarah963
Yup, it does not work here either.

I have to change the value of the radio-button field manually at the backend.

Thanks for pointing that out!

Please Log in to join the conversation.

8 years 2 months ago - 8 years 2 months ago #278527 by krileon
It has some internal checks to force reversal behavior for different fieldtypes. Specifically when reversing to 0 or empty string your reversal is ignored. This is fine if it's a single checkbox field, but a radio, select, or multicheckbox for example will behave unexpectedly. I recommend simply using CB Auto Actions with the below usage.

Plan Active
Triggers: onCPayUserStateChange
User: Automatic
Access: Everybody
Conditional 1: [var3] Equal To PLAN_ID_HERE
Conditional 2: [var2] Equal To A

Plan Expired
Triggers: onCPayUserStateChange
User: Automatic
Access: Everybody
Conditional 1: [var3] Equal To PLAN_ID_HERE
Conditional 2: [var2] Equal To X

This will let you use any action you want on subscription activate and deactivate basically. Letting you set and reverse several fields at once or even manage multiple usergroups.

Currently the CBSubs bug ticket is still pending review as we have to figure out how we want to handle the empty value scenario due to fieldtype specific reversal. In short fixing this causes another bug, but leaving it in it self is a bug. So we need to figure out a better way to deal with the 2 reversal scenarios properly.


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: sarah963, lousyfool

Please Log in to join the conversation.

8 years 2 months ago - 8 years 2 months ago #278561 by lousyfool
Hi Kyle,

Thanks for your prompt response again - great support!

I already thought that Auto Actions can come to help, and so this bug isn't high priority if it can be done with Auto Actions as well.

However...

krileon wrote: Plan Active
Triggers: onCPayUserStateChange
User: Automatic
Access: Everybody
Conditional 1: [var3] Equal To PLAN_ID_HERE
Conditional 2: [var2] Equal To A

Does not work. Something wrong with [var2]? (I don't quite get the [varX] thingy anyway, yet... one day I'll have that figured out as well, I hope, lol...)

krileon wrote: Plan Expired
Triggers: onCPayUserStateChange
User: Automatic
Access: Everybody
Conditional 1: [var3] Equal To PLAN_ID_HERE
Conditional 2: [var2] Equal To X

I changed it slightly to
Conditional 2: [var2] Not Equal To A
(to cover potential other states as I need the field value to be 1 only if the subscription is active), and it works.

Could still mean that something is wrong with [var2] or else because with these Auto Actions I'm only able to set values of 0, but not 1.

So, can you be bothered with taking another look at it, please? Thanks!

Please Log in to join the conversation.

8 years 2 months ago #278562 by krileon

Does not work. Something wrong with [var2]? (I don't quite get the [varX] thingy anyway, yet... one day I'll have that figured out as well, I hope, lol...)

You don't need to change the [var2] or [var3] usage. You only need to replace PLAN_ID_HERE with your plan id found under the id column in CBSubs > Plans.

I changed it slightly to
Conditional 2: [var2] Not Equal To A
(to cover potential other states as I need the field value to be 1 only if the subscription is active), and it works.

I don't recommend changing it from what I've provided.

Could still mean that something is wrong with [var2] or else because with these Auto Actions I'm only able to set values of 0, but not 1.

So, can you be bothered with taking another look at it, please? Thanks!

You can debug conditions or for errors by enabling debug mode and maximum error reporting in Joomla global configuration. Once done under the Parameters tab of your action you can enable debugging for the action it self.

Note if you're using a free lifetime plan you'll need to ensure your install is creating subscriptions for free lifetime plans within CBSubs > Settings > Global.

Please also check to ensure you're using still using CBSubs Fields or CBSubs SQL Actions to alter the field value as something maybe reverting its value.


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: lousyfool

Please Log in to join the conversation.

8 years 2 months ago #278566 by lousyfool

krileon wrote: You don't need to change the [var2] or [var3] usage. You only need to replace PLAN_ID_HERE with your plan id found under the id column in CBSubs > Plans.

That was all well understood and followed accordingly.

krileon wrote: I don't recommend changing it from what I've provided.

Sorry, didn't mean to mess with your settings. As explained, just meant to adjust them to my needs here... think I've seen somewhere that other values than "X" could be possible in the status field if plans are not active.

krileon wrote: Note if you're using a free lifetime plan you'll need to ensure your install is creating subscriptions for free lifetime plans within CBSubs > Settings > Global.

Yup, had figured that out already shortly after starting with CBSubs. ;)

krileon wrote: Please also check to ensure you're using still using CBSubs Fields or CBSubs SQL Actions to alter the field value as something maybe reverting its value.

Aaaaaah ok! Indeed, I had turned off CBSubs Fields in the plans, trusting that the Auto Actions would do it all. Turning them back on, now all is working!

Brilliant - it's solved! Many thanks for your help and patience!

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.329 seconds

Facebook Twitter LinkedIn