Limiting registrations

Hi, I would like to limit user registration on my website by registering to those who are under the age of 13. I have activated the personanalysed fields and inserted a field of choice for the date of birth on my registration form, but I do not know how to prevent the registration to those who are not 13 years old. Can someone help me?


PS: if possible, i want some solutions that not are the manual approval of the user. Thanks.

PS2: if is necessary the manual approval, how can i enable the email verification after the staff approval of the account in question?

Comments

  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    You need to write a plugin for that, but it would be quite simple. You can validate the form fields and give custom error messages. The code below should get you started:


       public function userModel_beforeSaveValidation_handler($sender, $args) {
           // Access the DateOfBirth like that:
           // $args['FormPostValues']['DateOfBirth'];
           // If you decide not to allow access, you need that line of code
           $sender->Validation->addValidationResult('DateOfBirth', 'Baby!');
       }
    


  • TheDark52TheDark52 New
    edited October 12

    There is no plugin for this? I don't know how to create a plugin from 0.🤣

    If i enable the registration aproval, there is the possibility to enable the email verification after the account approval?

    I suggest to add the age limit as a default option. In europe this is mandatory

Sign In or Register to comment.