Skip to Content Skip to Menu

AutoActions => Subscription active / expired

  • OldLodgeSkins
  • OldLodgeSkins
  • OFFLINE
  • Posts: 119
  • Thanks: 5
  • Karma: 2
  • Add-ons
9 years 4 months ago - 9 years 4 months ago #264755 by OldLodgeSkins
AutoActions => Subscription active / expired was created by OldLodgeSkins
Hi,

I've got a website where I'm displaying different profile types (using CB Profile Pro) depending on the user's subscription. Now I'd like to be able to automatically change that profile type (it's just a field, that's the easy part) depending on whether or not that person has a valid paying subscription at the time of logging in (I also allow free subscriptions and those should have a very different profile type, that's my point).

So I've got Before Profile Display and Before Profile Edit Display as my triggers, the action would be to change the value of "ProfileType" field... But what's the condition? That's the part I can't figure out so far.

Thanks.

Seb.

PS: the website was just upgraded to the latest versions of CB 2 and all the necessary add-ons.
Last edit: 9 years 4 months ago by OldLodgeSkins.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48429
  • Thanks: 8274
  • Karma: 1443
9 years 4 months ago #264764 by krileon
Replied by krileon on topic AutoActions => Subscription active / expired
To fire an action based off subscription state you'd used the below.

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

I'm not sure why you're using profile display triggers to change a field value though. Those fire a lot and it's going to impact the performance of your site as well as cause constant write access to your _comprofiler table doing that. Ideally you should make field changes that condition off other fields on the after profile update and after registration triggers. If the field value needs to change based off subscription then you'd use the above.


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.

  • OldLodgeSkins
  • OldLodgeSkins
  • OFFLINE
  • Posts: 119
  • Thanks: 5
  • Karma: 2
  • Add-ons
9 years 4 months ago #264834 by OldLodgeSkins
Replied by OldLodgeSkins on topic AutoActions => Subscription active / expired
To tell you the truth I don't even remember why I used those triggers in the first place... It was over a year ago and I handled the upgrade from CB 1.9.1 last week. Which went very smoothly by the way, I was (pleasantly) surprised :)

Anyway you're more than likely right so I'll try it. Thanks.

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

  • OldLodgeSkins
  • OldLodgeSkins
  • OFFLINE
  • Posts: 119
  • Thanks: 5
  • Karma: 2
  • Add-ons
9 years 4 months ago - 9 years 4 months ago #264838 by OldLodgeSkins
Replied by OldLodgeSkins on topic AutoActions => Subscription active / expired
Does this also work when I manually expire a subscription from the admin area? Because this is how I am testing for now and the field value doesn't change.

I currently have two auto actions, one for when the subscription is activated, one for when it expires.

Trigger : onCPayUserStateChange
Access: Everybody
User: Automatic

Conditions:
[var3] equals to 1 [No]
[var2] equals to A [No]

Action:
Field : Profile Type
Operator: Set (Field = Value)
Value: Subscriber
Translate Value: No

Did I miss something?
Actually I'm not too sure what those YES / NO switches are on the Conditions tab...

Thanks.
Last edit: 9 years 4 months ago by OldLodgeSkins.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48429
  • Thanks: 8274
  • Karma: 1443
9 years 4 months ago #264851 by krileon
Replied by krileon on topic AutoActions => Subscription active / expired
The subscription state changes before the backend user store. This causes whatever field change you make to be overridden by the backend user store. That's one of the few scenarios that won't work correctly. For this scenario you may want to use CBSubs Fields instead as it modifies the reference user object, which may allow it to store correctly. Be sure to test on frontend where it should work fine. Also ensure you supplied the plan id under the ID column within CBSubs > Plans and not the one under #.


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.

  • OldLodgeSkins
  • OldLodgeSkins
  • OFFLINE
  • Posts: 119
  • Thanks: 5
  • Karma: 2
  • Add-ons
9 years 4 months ago #264987 by OldLodgeSkins
Replied by OldLodgeSkins on topic AutoActions => Subscription active / expired
Ok... So this explains why the field isn't changed when I manually expire a subscription from the admin. No big deal. That was just for testing.
However it's not properly populated either when someone signs up and it should be... I'm wondering if there isn't something else changing it. I made that website so long ago I don't remember everything... I need to investigate this further.

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

Moderators: beatnantkrileon
Powered by Kunena Forum