Skip to Content Skip to Menu

🌟 CB Editor Assistant 1.0.0 is here! Discover our new AI Joomla Plugin that wrote its story! (and this banner!)
Start at just $12.50/month* or 💸 save 30% with our 🛍️ Black Friday Intro Offer for your subscription's lifetime
🎉 Black Friday sale is here! Great savings on professional and developer memberships! Get 25% off now with code BLACK-FRIDAY-2024!

Automatically delete a user from GroupJive groups on change in usergroup

  • LineMine
  • LineMine
  • OFFLINE
  • Posts: 160
  • Thanks: 22
  • Karma: 6
6 years 9 months ago #301492 by LineMine
Hi Kyle

I've nearly got this sorted, and it would be fine if I only had one paid plan to deal with. However, the upgrade/downgrade scenario is still triggering leave all GroupJive groups, for some reason.

However, I have an alternative suggestion for this.

I solved the issue of Registered users, by just creating a new usergroup, called Supporter, who are now the usergroup for the free lifetime subscriptions. For future reference, for some reason the Registered usergroup is not removed upon upgrade to paid plans, despite having it entered in the Access entry box in the free plan, but a new usergroup, Supporter is removed. This means that I can filter all users who are Supporters away from group joining using a redirect, as I wanted, because on upgrade they are removed from this group, and on expiry of any paid plan they will rejoin it.

Therefore, I'm wondering if I can also just remove all users in the usergroup Supporter from all groups in GroupJive? I've been trying to do this with onAfterUserUpdate and onAfterUpdateUser triggers, but no joy so far. It seems to me that this would be a much cleaner way to do it as there would be no issues with upgrading/downgrading between paid plans etc.

If this is not possible, then I'll go back to the CB Subs route, and send you a couple of screenshots to try and work out what I'm not doing

Thanks

Simon

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48560
  • Thanks: 8292
  • Karma: 1445
6 years 9 months ago - 6 years 9 months ago #301500 by krileon
I would just do the following

Auto Action 1
Global
Triggers: onCPayUserStateChange
Type: Usergroup
User: Automatic
Access: Everybody
Conditions
1: [var3] Equal To FREE_PLAN_ID_HERE
2: [var2] Equal To A
Action
Mode: Add Usergroups
Usergroups: FREE_USERGROUP_HERE

Auto Action 2
Global
Triggers: onCPayUserStateChange
Type: Usergroup
User: Automatic
Access: Everybody
Conditions
1: [var3] Equal To FREE_PLAN_ID_HERE
2: [var2] Not Equal To A
Action
Mode: Remove Usergroups
Usergroups: FREE_USERGROUP_HERE

Auto Action 3
Global
Triggers: onCPayUserStateChange
Type: Usergroup
User: Automatic
Access: Everybody
Conditions
1: [var3] Equal To PAID_PLAN_ID_HERE
2: [var2] Equal To A
Action 1
Mode: Add Usergroups
Usergroups: PAID_USERGROUP_HERE
Action 2
Mode: Remove Usergroups
Usergroups: FREE_USERGROUP_HERE

Auto Action 4
Global
Triggers: onCPayUserStateChange
Type: Usergroup
User: Automatic
Access: Everybody
Conditions
1: [var3] Equal To PAID_PLAN_ID_HERE
2: [var2] Not Equal To A
Action
Mode: Remove Usergroups
Usergroups: PAID_USERGROUP_HERE

Auto Action 5
Global
Triggers: onCPayUserStateChange
Type: CB Groupjive
User: Automatic
Access: FREE_USERGROUP_HERE
Conditions
1: [var3] Equal To PAID_PLAN_ID_HERE
2: [var2] Not Equal To A
Action
Mode: Mode
Groups: All

The above would add/remove usergroups as needed based off their subscription. The final action would make them leave all GJ groups if their paid subscription is removed AND they've the free usergroup. You should be able to add as many 1-4 action cases as you need if you've more plans. The conditions can also be adjusted to support more than 1 plan id. Example as follows.

1: [var3] Is REGEX /^(PLAN_ID_1|PLAN_ID_2|PLAN_ID_3)$/

Also notice with the above in Action 3 when adding the paid usergroup the free one is gone ahead and removed. You may want to do a user reload for all of these under their Parameters tab as well just to be safe.


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: 6 years 9 months ago by krileon.

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

  • LineMine
  • LineMine
  • OFFLINE
  • Posts: 160
  • Thanks: 22
  • Karma: 6
6 years 9 months ago - 6 years 9 months ago #301535 by LineMine
Hi Kyle

Thank you for those Auto Action suggestions. I really appreciate your help on this. For some reason the Action 5, which is designed to clear the free user group from GroupJive groups, only works if Access is set to Everybody, or if the Registered usergroup is included with the free one (this is effectively the same as all users are included in Registered with upgrades/downgrades. I have set all action to user reload as you suggested.

In any case, for now I'm going to simplify the plans down to one free and one paid, until I have a better understanding both of CB Subs and also the Auto Actions plugin, so I have a setup that works I have a test site I can work on with this.

I do have one small problem though. I am unable to delete the upgrade plan (Trader Plus) as it is showing 4 subscribers (my test users). However, opening their profiles does not show them as subscribed to these plans, (and they are listed as having cancelled in the subscriber lists),so no way of deleting them from it, and looking at the logs for this plan, there is a loading error showing up. See attachments below. I would like to sort this out before I proceed with making the single paid plan live.

One other question; i noticed that cancelling subscriptions, which I have set to auto-recurring on a monthly basis, cancels them immediately. Is there a way to allow cancellation but the subscription then runs to the end of the paid period?

Thanks again.

Simon
Attachments:
Last edit: 6 years 9 months ago by LineMine.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48560
  • Thanks: 8292
  • Karma: 1445
6 years 9 months ago #301550 by krileon

For some reason the Action 5, which is designed to clear the free user group from GroupJive groups, only works if Access is set to Everybody, or if the Registered usergroup is included with the free one (this is effectively the same as all users are included in Registered with upgrades/downgrades. I have set all action to user reload as you suggested.

Try changing it to the following.

Auto Action 5
Global
Triggers: onCPayUserStateChange
Type: CB Groupjive
User: Automatic
Access: FREE_USERGROUP_HERE
Conditions
1: [var3] Equal To FREE_PLAN_ID_HERE
2: [var2] Equal To A
Action
Mode: Mode
Groups: All

That should only remove them from their groups if the free plan becomes active and only if they've been assigned the free usergroup.

I do have one small problem though. I am unable to delete the upgrade plan (Trader Plus) as it is showing 4 subscribers (my test users). However, opening their profiles does not show them as subscribed to these plans, (and they are listed as having cancelled in the subscriber lists),so no way of deleting them from it, and looking at the logs for this plan, there is a loading error showing up. See attachments below. I would like to sort this out before I proceed with making the single paid plan live.

If it's all just test data you can empty the _cbsubs_subscriptions table directly. Otherwise you need to manually edit them in backend and select the delete checkbox next to the plan.

One other question; i noticed that cancelling subscriptions, which I have set to auto-recurring on a monthly basis, cancels them immediately. Is there a way to allow cancellation but the subscription then runs to the end of the paid period?

At this time, no.


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

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

Moderators: beatnantkrileon
Powered by Kunena Forum