Skip to Content Skip to Menu

User Limitation

  • adhillon
  • adhillon
  • ONLINE
  • Posts: 59
  • Thanks: 4
  • Karma: 1
3 weeks 2 days ago #340131 by adhillon
User Limitation was created by adhillon
We have two community subscriptions: Free and Premium. 

To Free users we want to offer a community of maximum 150 members. How can this be achieved?
If this is not do-able, is there any other way to impose limitations on a community size?

We also want to auto-expire free memberships, so that after 1 year of inactivity the membership is inactivated, and after 18 months the membership is deleted along with the data. 

Please advise.

 

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48844
  • Thanks: 8346
  • Karma: 1449
3 weeks 2 days ago - 3 weeks 2 days ago #340134 by krileon
Replied by krileon on topic User Limitation

To Free users we want to offer a community of maximum 150 members. How can this be achieved?

There isn't a way to limit a plan to a number of active subscribers out of the box. I think the best way to do that is probably a condition under the Workflows tab against a Query field that counts the number of subscribers. This would be a neat feature though and have added a feature ticket for it.

forge.joomlapolis.com/issues/9598

We also want to auto-expire free memberships, so that after 1 year of inactivity the membership is inactivated

This is easy enough by just having the free plan have a duration of 1 year.

and after 18 months the membership is deleted along with the data.

This is a bit more tricky. Automating user deletion is risky. 1 mistake in the configuration and you've wiped your userbase. So while it is doable I don't recommend doing it and instead just deleting inactive accounts once a year in CB > User Management. If you still want to do this you can do so using CB Auto Actions with the below instructions.

Navigate to CB Auto Actions > Actions and create the following action

Global
Triggers: None
Type: Code
User: Automatic
Access: All Non-Moderators (safety measure to ensure moderation isn't deleted)
Conditions
Field: Custom > Value
Custom Value: [cb:parse function="time"][lastvisitDate][/cb:parse]
Operator: Less Than or Equal To
Value: [cb:parse function="time" time="-18 MONTHS"]now[/cb:parse]
Action
Method: PHP
Code:
Code:
$user->delete();


Save the auto action then set "Allow Direct Access" to "No" and save it again. This gives you an auto action that can only be ran programmatically and not from triggers or from URLs.

Navigate to CB Auto Actions > Batches and create a new Batch processor.

Global
Users: All Non-Moderators
Access: Everybody
Actions
select the above action here
Advanced Filter
WHERE:
Code:
u.`lastvisitDate` <= SELECT DATE_SUB( NOW(), INTERVAL 18 MONTH )


The above example is entirely based off last login date as it's a bit unclear what you mean by inactivity. The above is just an example. It has NOT been tested. Please do so carefully on a test install and confirm working as expected before applying to a live site. You may need to add extra conditions to the auto action like excluding those with a paid subscription.

Now all you need to do is setup a CRON task, or Joomla task schedular, to run the batch URL (it's under the Global tab after saving the batch) once a day. This will loop through your userbase that matches the filters and run them through the auto 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.
Last edit: 3 weeks 2 days ago by krileon.

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

  • adhillon
  • adhillon
  • ONLINE
  • Posts: 59
  • Thanks: 4
  • Karma: 1
1 week 2 days ago #340305 by adhillon
Replied by adhillon on topic User Limitation
It may be a better option to send email alerts when member threshold in a Community is reached or exceeded. 
How could we do that?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48844
  • Thanks: 8346
  • Karma: 1449
1 week 2 days ago #340309 by krileon
Replied by krileon on topic User Limitation
So send an email once there's a specific amount of free subscribers? To whom? Can you be more specific about what you're wanting exactly?


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.

  • adhillon
  • adhillon
  • ONLINE
  • Posts: 59
  • Thanks: 4
  • Karma: 1
1 week 2 days ago #340310 by adhillon
Replied by adhillon on topic User Limitation
Sorry for the ambiguity.
This relates to a previous inquiry about limiting the number of members in a group (community). You said that there was no way to limit members in a group. 
If we offer a community group of maximum 500 users, and since there is no way to limit 'maximum', could we generate an email alert when the number (500) is exceeded? 

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48844
  • Thanks: 8346
  • Karma: 1449
1 week 1 day ago #340321 by krileon
Replied by krileon on topic User Limitation
Ah, I suppose I misunderstood as your original post had me thinking this was related to subscription limits. Yes, it's possible to block joining groups based off a custom limit and doing whatever behavior you like during that process. The gj_onBeforeJoinGroup trigger is fired before a group join. The below should block users from joining the group if the group already has 500 members and will send an email.

Global
Triggers: gj_onBeforeJoinGroup
Type: Email
User: Automatic
Access: Everybody
Conditions
Field: Custom > Query
Query:
Code:
SELECT COUNT(*) FROM `#__groupjive_users` WHERE `group` = '[var2_id]'
Operator: Equal To
Value: 499
Action
CONFIGURE_MEAIL_AS_NEEDED

Global
Triggers: gj_onBeforeJoinGroup
Type: Code
User: Automatic
Access: Everybody
Conditions
Field: Custom > Query
Query:
Code:
SELECT COUNT(*) FROM `#__groupjive_users` WHERE `group` = '[var2_id]'
Operator: Greater Than Or Equal To
Value: 500
Action
Method: PHP
Code:
Code:
$variables['var1']->setError( 'This group has reached its limit.' );
Parameters
Reference Variables: Variable 1

The above will send an email when the 500th member joins. If anyone over the 500th member attempts to join it will block the join and output an error message as to why.


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