Skip to Content Skip to Menu

Second access level based on CB field

  • hac
  • hac
  • OFFLINE
  • Posts: 50
  • Thanks: 1
  • Karma: 0
10 years 1 month ago #249479 by hac
Hi,

Using CBSubs 3.0 on Joomla 3.3.3 site.

I have a use case where when a user buys a subscription I change their User Group to "Member". But if the user has a specific CB field ticked they also need to be given "BOD" User Group. So, the member will be able to access content that has been set for Member or BOD viewing. When the member's plan expires they need to go from "Member" back to being "Registered" and the "BOD" User Group needs to be removed as well.

I am not sure how to set this up in the plan.

Right now under the Access tab I have set "Subscribers User access level settings" to "Member". I gather that when their subscription expires they will be changed back to "Registered"?

But how to I get the other "BOD" Access Level added on subscription and removed on expiration for the users that have the CB field set?

Thank you for any help on this.

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 #249494 by krileon
Replied by krileon on topic Second access level based on CB field
CBSubs won't remove the Registered usergroup. So they'll be both Registered and Member then CBSubs will remove Member when expired. To add usergroups based off a CB field you can do that using CB Auto Actions. Please see the below tutorial on how to do that.

www.joomlapolis.com/support/tutorials/107-use-cases/18237-cb-auto-actions-assigning-usergroup-based-on-cb-field-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.

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 #249509 by hac
Replied by hac on topic Second access level based on CB field
Hi,

I am having some issues with CBSubs 3.0.0 and CB 2.0RC3 on Joomla 3.3.3 site.

First when I subscribe to a new plan, the "Subscribers User access level settings" that I have set, "Member" is not being applied to the new member. You said above that the Member group would be added and removed when the member subscribed and expired. Neither is happening, it is not being added on subscription and if I hand add it, it is not being removed on expiration.

When I try to login using CB Login module after the member's subscription has expired, I am getting the following error:
PHP Fatal error: Call to undefined method CBACL::getBackwardsCompatibleGid() in /home/humanise/public_html/components/com_comprofiler/plugin/user/plug_cbpaidsubscriptions/libraries/cbpaidUserExtension.php on line 368.

CB is also not showing the subscriptions that the person has like CB 1.9.1 did.

Thanks.

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 #249512 by hac
Replied by hac on topic Second access level based on CB field
Hi Kyle,

I looked at the Auto Action example but I don't know what trigger to use. I want to add the User Group when the user gets a new subscription added. I tried using "onCPayAfterPaymentStatusUpdateEvent" but if the subscription is added via the Backend by the Admin, this event doesn't get triggered, I guess. I need an event that will get triggered no matter how the subscription is added, frontend or backend.

Then I need a trigger for when the subscription expires so I can remove the user group. What trigger would I use for that?

Thank you for your help.

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 #249541 by krileon
Replied by krileon on topic Second access level based on CB field

First when I subscribe to a new plan, the "Subscribers User access level settings" that I have set, "Member" is not being applied to the new member. You said above that the Member group would be added and removed when the member subscribed and expired. Neither is happening, it is not being added on subscription and if I hand add it, it is not being removed on expiration.

The users subscription needs to become active. They also won't receive the usergroup if you're giving them a subscription from backend as user store will override it. This is a known issue, but does not affect frontend. If your plan is a free lifetime plan then you need to ensure free lifetime plans create subscriptions within CBSubs > Settings > Global.

When I try to login using CB Login module after the member's subscription has expired, I am getting the following error:
PHP Fatal error: Call to undefined method CBACL::getBackwardsCompatibleGid() in /home/humanise/public_html/components/com_comprofiler/plugin/user/plug_cbpaidsubscriptions/libraries/cbpaidUserExtension.php on line 368.

That looks like a CBSubs B/C issue. We'll probably need to add that function back since it causes fatal issues. There's no fix for that at this time.

CB is also not showing the subscriptions that the person has like CB 1.9.1 did.

Do not be doing all this on CB 2.0 unless you're just trying to provide testing and compatibility feedback. None of the CB 1.x plugins are compatible with CB 2.0. We've some basic legacy layer API in place to try and avoid fatal errors, but there's no guarantee of functionality.

I looked at the Auto Action example but I don't know what trigger to use. I want to add the User Group when the user gets a new subscription added. I tried using "onCPayAfterPaymentStatusUpdateEvent" but if the subscription is added via the Backend by the Admin, this event doesn't get triggered, I guess. I need an event that will get triggered no matter how the subscription is added, frontend or backend.

You can use the below triggers and conditionals for CBSubs subscription states.

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

Replace PLAN_ID_HERE with the actual ID of your plan that you want to test for.


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 #249587 by hac
Replied by hac on topic Second access level based on CB field
Hi Kyle,

I was able to get the user group added on new subscriptions but I haven't been able to get it to be removed when the subscription expires.

I have a query field set up: cb_activesubscriptions to count the number of active subscriptions using this SQL:
SELECT COUNT(*) FROM `#__cbsubs_subscriptions` WHERE `user_id` = '[user_id]' AND `status` = 'A'.

In my Auto Action to remove the User Group on expiration I have the following settings:
Type: Usergroup
Triggers: onCPayUserStateChange
User: Automatic
Conditionals: [cb_activesubscriptions] Equal to 0
[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



Can you see why the Usergroup won't be removed when the subscription expires?

Thank you for your help.
Attachments:

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

Moderators: beatnantkrileon
Powered by Kunena Forum