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.
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.
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.
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.
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.
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.