Skip to Content Skip to Menu

🏖 Summer has arrived! Start your summer right with our summer sale! Get 25% off professional and developer memberships with code SUMMER-2025!

[CBSubs] Removing member from usergroup upon upgrading/renewing

  • AlexRag
  • AlexRag
  • ONLINE
  • Posts: 523
  • Thanks: 34
  • Karma: 6
1 day 1 hour ago - 1 day 1 hour ago #341523 by AlexRag
My ask here is similar to my use case in this post:   www.joomlapolis.com/forum/developer-members-support/247045-automatically-moving-members-from-one-group-to-another-on-expiration#339232 , where I wanted expiring members to be moved from a "Paid Member" usergroup to a "Free Member" usergroup (instead of just the standard Joomla "registered" one, which CBSubs does by default).   The solution is an AutoAction as described below:

Global
Triggers: onCPayUserStateChange
Type: Usergroup
User: Automatic
Access: Everybody
Conditions
Condition 1
Field: Custom > Value
Custom Value: [var3]
Operator: Equal To
Value: PLAN_ID_HERE
Condition 2
Field: Custom > Value
Custom Value: [var2]
Operator: Not Equal To
Value: A
Action
Action 1
Mode: Remove Usergroups
Usergroups: REMOVE_USERGROUP_HERE
Action 2
Mode: Add Usergroups
Usergroups: ADD_USERGROUP_HERE

Replace PLAN_ID_HERE with your plans id. That auto action should then fire when their plan expires. If you know they'll only have those 2 usergroups you can just use the Replace Usergroups mode.

I am looking to do something that is, in a way, the reverse.

This new use-case came about because I discovered that when "Free Plan" members who are in a Free Plan usergroup upgrade to a Paid Plan, they are not only added to the "Paid Plan" usergroup but also kept in the "Free Plan usergroup. 

I'd like the ability to remove a user from the "Free Member" usergroup when they upgrade, and wondering if I should use the same trigger "onCPayUserStateChange"

The reason this has become a problem is that I have some AutoActions that limit access to certain things to Free Members based on which user group they are in.    That being said, I may be able to revise these autoActions since there is now a "Subscriptions" condition instead of currently using the "usergroups" condition.

Regardless, I think it will be too confusing to have members in two user groups (It also makes it harder to filter searches in the backend).  Could I get some advice on how best to remove users from a usergroup upon a plan change that is an upgrade or renewal?
Last edit: 1 day 1 hour ago by AlexRag.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 49350
  • Thanks: 8445
  • Karma: 1465
16 hours 10 minutes ago #341528 by krileon

This new use-case came about because I discovered that when "Free Plan" members who are in a Free Plan usergroup upgrade to a Paid Plan, they are not only added to the "Paid Plan" usergroup but also kept in the "Free Plan usergroup.

That should not happen if both plans are correctly configured to manage usergroups. So for your free plan ensure it's configured under its Access tab to grant your free plan usergroup otherwise it won't be removed on upgrade. I would set this up as something like the following.

Public
- Registered
- - Free Tier
- - Pro Tier

Your free plan should be configured to manage "Free Tier" and your paid plan manage "Pro Tier" in this example. The usergroups should safely be removed when upgrading, etc..

If you still want to have CB Auto Actions manage usergroups then my examples in that topic already cover that. See my reply below in that topic for changing usergroups when a plan becomes active or inactive.

www.joomlapolis.com/forum/developer-members-support/247045-automatically-moving-members-from-one-group-to-another-on-expiration#339347


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.

  • AlexRag
  • AlexRag
  • ONLINE
  • Posts: 523
  • Thanks: 34
  • Karma: 6
11 hours 46 minutes ago - 11 hours 41 minutes ago #341531 by AlexRag
Ah, I quoted an earlier iteration of the AutoAction.  Thanks for pointing that out.  

But what is odd is that I had both plans "Subscribers User access level setting" set to the respective usergroups (As in this example).   

 

In the previous case, when a plan expired, the members were moved to the standard "Registered" plan, so I added the auto action to move them to the Free Tier user group instead.   By the way, they were pulled out of the Pro Tier when it expired.  In many ways, this is really a downgrade to a lower-tier plan rather than no plan.

What could be causing the upgrading members to not be pulled out of the Free Tier usergroup?  Am I missing another plan setting?  Or maybe some auto action conflicting with the functionality?

I think part of what may be different is that I created a "Free Plan" and set it up much like a paid one, so even though the member has expired, they are still in a CBSubscription Plan as opposed to just a registered user with no CBSub controlled Plan.  Could this have something to do with this?



Side question: When looking at the Usergroup Action in AutoAction, what does the "Replace Usergroups" do as opposed to Add or Remove Usergroups?
Last edit: 11 hours 41 minutes ago by AlexRag.

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

Moderators: beatnantkrileon
Powered by Kunena Forum