Skip to Content Skip to Menu

Second access level based on CB field

  • krileon
  • krileon
  • ONLINE
  • Posts: 48479
  • Thanks: 8283
  • Karma: 1443
10 years 1 month ago - 10 years 1 month ago #249608 by krileon
Replied by krileon on topic Second access level based on CB field
I can't help you with your custom conditionals as they're custom fields so I've no idea your setup or usage of them. You don't need to condition off a field or store what subscription is active for this to work. The trigger already contains that information. Please see my above post for performing an action on a plan becoming active or expired.

That trigger fires when an individual plans subscription state for a user changes so your conditions should be checking for a specific plan and a specific state. Your current usage is just checking for a count based off no specific plan and some other field. So the action could end up firing 3 times in a row if the user subscribed to 3 plans.


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.
Last edit: 10 years 1 month ago by krileon.

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

  • hac
  • hac
  • OFFLINE
  • Posts: 50
  • Thanks: 1
  • Karma: 0
10 years 1 month ago #249631 by hac
Replied by hac on topic Second access level based on CB field
Hi,

The problem with what you suggested is that I have 5 different plans and I only want to turn off the user group if the cb_officiant field is set to 1 and the user's current plan expires. I checked in the database and the cb_officiant field is 1 when that CB field is checked for the user.

The user can only have 1 membership plan active at a time.

Since there are 5 different plans, that is why I setup the cb_activesubscriptions query field to count how many active memberships the user currently has. If they don't have any active memberships and they had the cb_officiant field set to 1, then I want to remove the user group.

If I use what you have above, I would have to have 5 auto actions one for each membership plan would I not?

Thank you.

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

  • hac
  • hac
  • OFFLINE
  • Posts: 50
  • Thanks: 1
  • Karma: 0
10 years 1 month ago #249640 by hac
Replied by hac on topic Second access level based on CB field
Hi Kyle,

Ok, I changed the triggers and conditions like you suggested, but the user group is still not being removed by the auto action. The plans that I want to have the user group removed when they expire are id 1 and 2, cb_officiant is the field that determines if the user group needs to be removed. If set to 1 the user group needs to be removed.

In my Auto Action to remove the User Group on expiration I have the following settings:
Type: Usergroup
Triggers: onCPayUserStateChange
User: Automatic
Conditionals: [var3] Less than or Equal to 2
[var2] Equal to X
[cb_officiant] Equal to 1 <- this is the field that tells me if the user group needs to be added or removed
User Group Actions Mode: Remove Usergroups
Group: Officiant



It is like the remove user group function is not working. I don't know how to debug this, to see if the conditions are being triggered or not, as it happens automatically.

I used this to add the user group and it is working:
Type: Usergroup
Triggers: onCPayUserStateChange
User: Automatic
Conditionals: [var3] Less than or Equal to 2
[var2] Equal to A
[cb_officiant] Equal to 1
User Group Actions Mode: Add Usergroups
Group: Officiant

The only difference is the [var2] being X instead of A and the Mode being Remove Usergroups instead of Add Usergroups.

Any ideas?

Thank you.
Attachments:

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

  • hac
  • hac
  • OFFLINE
  • Posts: 50
  • Thanks: 1
  • Karma: 0
10 years 1 month ago #249656 by hac
Replied by hac on topic Second access level based on CB field
Hi,

I tried again with the cb_officiant EQUAL TO 1 condition removed, but the User group is still not being removed.

Are you sure that removing user groups is working?

Thank you.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48479
  • Thanks: 8283
  • Karma: 1443
10 years 1 month ago #249682 by krileon
Replied by krileon on topic Second access level based on CB field
Remove all your conditionals then retry to see if working. It's possible a user store from elsewhere (even CBSubs) could be reverting the usergroup change. I'm currently working on upgrading CB Auto Actions for CB 2.0. It could be bugged. I won't know until I get to upgrading that action.


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.

  • hac
  • hac
  • OFFLINE
  • Posts: 50
  • Thanks: 1
  • Karma: 0
10 years 1 month ago #249701 by hac
Replied by hac on topic Second access level based on CB field
Hi Kyle,

I did as you suggested removed all the conditions, Saved, re-applied the [var3] and [var2] conditions, but it didn't help. The user group still wasn't removed on expiration.

The only other thing that is changing user groups is in CBSubs plans. I have the plan set so it adds and removes the user group "Member" when the plan is activated or expires.

Can you think of another way to have this functionality, we need to go live with the site in the next week.

I have some menu items that only Officiants are supposed to be able to see. There isn't a specific CB Subs plan for Officiants, the will use one of the general plans to obtain their membership, so I can't limited the menu access based on the CBSubs plan. To view the menu items they need to have an active subscription of any kind and have the cb_officant field set to 1. So, I thought I would add the Officiant User Group to members with an active plan and the cb_officant field set to 1, (which works great) and then when the membership expired to remove the Officiant User Group, but that isn't working. Since that isn't working I need another way to have those menu items display only for active member Officiants.

A nice feature for CB Subs next version would be to be able to multi-select the "Subscribers User access level settings" User Groups. Then the auto actions wouldn't be needed.

Thanks,

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

Moderators: beatnantkrileon
Powered by Kunena Forum