Skip to Content Skip to Menu

[CBSubs] Removing member from usergroup upon upgrading/renewing

  • AlexRag
  • AlexRag
  • ONLINE
  • Posts: 587
  • Thanks: 43
  • Karma: 7
1 month 4 days ago - 1 month 4 days 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 month 4 days ago by AlexRag.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 49480
  • Thanks: 8471
  • Karma: 1465
1 month 4 days 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: 587
  • Thanks: 43
  • Karma: 7
1 month 4 days ago - 1 month 4 days 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: 1 month 4 days ago by AlexRag.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 49480
  • Thanks: 8471
  • Karma: 1465
1 month 3 days ago #341540 by krileon
Is the free plan a free lifetime plan? If so within CBSubs > Settings > Global ensure you've configured for free lifetime plans to create subscriptions as that's a situation where usergroup management won't work as expected since their free lifetime plan won't actually create a subscription. So going back to my earlier example of usergroups.

Public
- Registered
- - Free Tier
- - Pro Tier

With this you'd set the usergroup applied to new users within Joomla to Registered. So when they subscribe to the free plan they'd have Registered and Free Tier usergroups. When their free plan is taken away they should just be Registered.

Side question: When looking at the Usergroup Action in AutoAction, what does the "Replace Usergroups" do as opposed to Add or Remove Usergroups?

Replace Usergroups completely replaces all of their usergroups with the ones you've selected. It basically just combines Add and Remove into a single 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.

  • AlexRag
  • AlexRag
  • ONLINE
  • Posts: 587
  • Thanks: 43
  • Karma: 7
3 weeks 4 days ago - 3 weeks 4 days ago #341626 by AlexRag
Circling back to this - sorry for the late response.

Is the free plan a free lifetime plan? If so within CBSubs > Settings > Global ensure you've configured for free lifetime plans to create subscriptions as that's a situation where usergroup management won't work as expected since their free lifetime plan won't actually create a subscription. So going back to my earlier example of usergroups

In answer to your question, the free plan, yes, the free plan is set up as lifetime, and I think I set up the global setting correctly (as shown below).

So I have set things up as you indicate, so free signups end up in the Free Tier User group.   When they upgrade, they are meant to be pulled out of Free Tier and move up to Pro Tier.

Public
- Registered
- - Free Tier
- - Pro Tier

 

I also recently created a second paid plan to upgrade to and set up the "Subscribers User access level settings" to add them to the same Pro Tier usergroup as my other paid plan, but for some reason, when users upgrade from the free plan to the new paid one, they are not only not being taken out of the Free Tier usergroup and they are also not even being added to the Pro Tier usergroup

 

I'm at a loss now.  The older paid plan added users to the correct usergroup but also kept them in the free usergroup.   This second new paid plan is not doing either (pull out of Free, add to Pro Tier).

Should I resort to AufoActions?
Last edit: 3 weeks 4 days ago by AlexRag.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 49480
  • Thanks: 8471
  • Karma: 1465
3 weeks 4 days ago #341635 by krileon
It can be complicated to setup. Below is how for example my test site for this is setup.

Public
- Registered = New Registered Users Usergroup
- - Free = Usergroup Assigned in Free Plan
- - Paid = Usergroup Assigned in Paid Plan

With this configuration I'm having no issues with it switching, adding, removing usergroups. Your users with this setup would always have the Registered usergroup and only Free/Paid would be Added/Removed. Both Free and Paid plans are marked Exclusive to ensure they can be upgraded properly.

If this is still not working for you then yes you can setup more strict configurations using CB Auto Actions.


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.

Moderators: beatnantkrileon
Powered by Kunena Forum