Modifying ACL level after membership expires

10 years 8 months ago #233808 by derekkoopowitz
Modifying ACL level after membership expires was created by derekkoopowitz
Just some background...

Our organization is membership based and we have one user group defined for all our members. When someone purchases a membership, the membership user group is assigned to them (which then controls access to various resources on the website). So, when a new user (not a member yet) creates an account on our website they are assigned the "Registered" user group level. If they join our organization CBSubs will assign them the "NSRCA Membership" user group level... everything is great up to this point. If that membership expires, all the necessary changes are made to their user record, however the one change that is not made is to remove them from the "NSRCA Membership" user group. See the user groups below...




Is there a way to have CBSubs remove them from this user group, or do I need to write some SQL code to remove them using the SQL Action integration plugin? Under the "Access" tab for the plan, there is an entry to add the user to the user group. Shouldn't CBSubs automatically remove that user from the group when the plan expires?


One other question or feature request:

It would be nice to have the ability to purchase a membership for someone else. For instance, if I have 2 people in my family (my son and I) that belong to the organization, it would be nice to be able to purchase (or renew) my membership and my son's membership at the same time instead of having to log on as me first, do a purchase, and then log on as him and do a purchase. Obviously, both users would need to be users on the website in order for this to happen.

Is this possible in CBSubs? If not, can this be added?

Thanks.
Attachments:

Please Log in to join the conversation.

10 years 8 months ago #233814 by krileon
Replied by krileon on topic Modifying ACL level after membership expires

Shouldn't CBSubs automatically remove that user from the group when the plan expires?

Yes, as long as you plan is configured to give the usergroup it should also remove it on expiration. Is the user truly expired or still in Grace period for example? Check within CBSubs > Subscriptions to confirm their subscription has been marked expired. Also if they have another plan that's still active that controls the same usergroup then it won't remove it.

Is this possible in CBSubs?

No.

If not, can this be added?

Not currently, but it's planned in a future release.


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 to join the conversation.

10 years 8 months ago - 10 years 8 months ago #233816 by derekkoopowitz
Replied by derekkoopowitz on topic Modifying ACL level after membership expires
Thanks. I had my grace period set at 3 months after expiration so perhaps that is why the access wasn't removed. I did create a test plan today which had a duration of 5 minutes with no grace period - I'll check to see if the user group is removed. I did write the following SQL code to delete the user group from the user though which works well:

DELETE * from `#_user_usergroup_map` WHERE `user_id` = '[user_id] AND `group_id` = (SELECT `id` FROM `#_usergroups` WHERE `title` = 'NSRCA Members');

I also will need to do something similar except that I need to add another user group to a new member (in addition to the one that the plan assigns) and obviously delete it when it expires as well. Is this possible with CBSubs? When a plan is purchased to automatically assign them to another plan at the same time?

Thanks for the consideration of adding that feature to a future release. I would imagine that would be very useful to memberships/subscription systems. Our previous membership management system used it.

Please Log in to join the conversation.

10 years 8 months ago #233822 by krileon
Replied by krileon on topic Modifying ACL level after membership expires

Thanks. I had my grace period set at 3 months after expiration so perhaps that is why the access wasn't removed.

Correct, it will not remove the usergroup until they are truly expired.

I did write the following SQL code to delete the user group from the user though which works well:

I don't suggest doing direct database changes to ACL.

I also will need to do something similar except that I need to add another user group to a new member (in addition to the one that the plan assigns) and obviously delete it when it expires as well. Is this possible with CBSubs? When a plan is purchased to automatically assign them to another plan at the same time?

Currently you can only assign 1 usergroup per plan. So you'll need to use an INSERT query similar to your delete query to add the extra usergroup on plan activation. We've plans to improve this with a later release so it'll be possible to add/remove multiple usergroups.


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

Please Log in to join the conversation.

10 years 5 months ago - 10 years 5 months ago #237143 by deltafidesign
Replied by deltafidesign on topic Modifying ACL level after membership expires
I have a similar problem now.

I see that a user account has expired, but it's still assigned to 2 groups: Registered and Partners.

When he registered, was assigned to Registered and Partners group.

I would expect it would be assigned only to Registered group after expired and grace period is "None".

Why it's still assigned to "Partner" user group?

Also, how can I move it to the group "Partner Expired" after exprired? An auto Action?

Please Log in to join the conversation.

10 years 5 months ago #237206 by krileon
Replied by krileon on topic Modifying ACL level after membership expires
I suggest using CB Auto Actions to handle your usergroup assignment as it has much more advanced usages (replace, add, remove, etc..). CBSubs needs to have its usergroup usage upgraded (planned for a later release). Below is how to use CB Auto Actions to handle assignment.

Add Usergroup
Type: Usergroup
Triggers: onCPayUserStateChange
Access: Everybody
Conditional 1: [var3] Equal To PLAN_ID_HERE
Conditional 2: [var2] Equal To A
Mode: Add Usergroup
Groups: SELECT_GROUPS_TO_ADD_HERE

Remove Usergroup
Type: Usergroup
Triggers: onCPayUserStateChange
Access: Everybody
Conditional 1: [var3] Equal To PLAN_ID_HERE
Conditional 2: [var2] Not Equal To A
Mode: Remove Usergroup
Groups: SELECT_GROUPS_TO_REMOVE_HERE


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 to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.235 seconds

Facebook Twitter LinkedIn