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 🛍️ Intro Black Friday Offer for a lifetime*

How to use Auto Action to restrict New User registrations (in Backend

  • timstohr
  • timstohr
  • OFFLINE
  • Posts: 1091
  • Thanks: 56
  • Karma: 9
5 years 6 months ago #312225 by timstohr
Hi Kyle,
I wanted to restrict the registration of new users once the users are higher than a field which I set. How can I interrupt the creation of a new user using Auto action?
Or any other ideas how to restrict user registrations beyond a certain limit?
Or would it work if I all users who are beyond a value of a community builder field get promoted into a group which will effectively not allow them to register (ie outside of "registered" group)?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48556
  • Thanks: 8292
  • Karma: 1445
5 years 6 months ago #312238 by krileon
A user can't register twice. A bit confused on what you're trying to do. You're wanting to block backend user create for some admins?


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.

  • timstohr
  • timstohr
  • OFFLINE
  • Posts: 1091
  • Thanks: 56
  • Karma: 9
5 years 6 months ago #312240 by timstohr
I am basically "renting" out my website and the person who rents it has to pay by user. So if he pays to have a maximum of 20 users, then I had imagined that I set a CB Field to have a value of 20 (he cannot change that value because he has no access to it) and he cannot create anymore than 20 users.

Is that possible somehow? Can you think of how to make it possible?

Please note, I cannot simply bump him to a user group that is not allowed to create users in the backend because then he would loose a lot of privileges that are associated with the current user creation role.

Kind regards,
Tim

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48556
  • Thanks: 8292
  • Karma: 1445
5 years 6 months ago - 5 years 6 months ago #312241 by krileon
Yes that's possible. You'd need to act on the backend user create trigger before any user stores have been made. Specifically the onBeforeNewUser trigger. To block it you need to throw a plugin error.

Global
Triggers: onBeforeNewUser
Type: Code
User: Self
Access: Everybody
Action
Method: PHP
Code:
Code:
global $_PLUGINS; $_PLUGINS->_setErrorMSG( 'You have reached the user create limits for your site.' ); $_PLUGINS->raiseError();

If you want this to also apply to frontend then add onBeforeUserRegistration to the triggers list. Note you will need to add your condition to check against the create limit or do so in the code it self. If the user limit field is on a specific user then you may want to set User to Specific and just specify that users ID to make substitutions be based off that user so setting up your condition would be easier.


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

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

Moderators: beatnantkrileon
Powered by Kunena Forum