2

In my system, I have a user profile field which named "Day of birth". Its type is datetime. I want to validate to restrict user's age when he registers new account or edit his profile. For example, user must be at least 18 years old when he registers to our system. Pre-condition:

  1. I use Moodle 3.3.4
  2. I do not want to edit moodle core files.

Is there anyway solve my problem?

Any solution, suggestion or searching keyword are welcome!

Nghi Ho
  • 463
  • 1
  • 6
  • 18
  • 1
    Unfortunately this is not a core functionality of Moodle and there are no plugins for this that I am aware of. I have implemented something similar feature to this without changing core code by using JQuery. The JQuery would hide the submit button until an appropriate age had been selected. I was however using a custom theme, which contained the JS file. Are you using any custom plugins/themes? If not, you will have to change core code to achieve this outcome. – CloudJake Mar 05 '18 at 12:53
  • 1
    @jordan121sa, thank you for your comment. I am also using a custom theme. JQuery is a possible solution, but I am not happy with it! – Nghi Ho Mar 07 '18 at 04:14
  • I do not believe there is any other way to achieve it unless you want to create a entire custom page for sign up and redirect the user there. – CloudJake Mar 07 '18 at 04:40
  • 1
    Sadly! `customscripts` is another "hack" way, but my client will not accept it. – Nghi Ho Mar 07 '18 at 05:28
  • 1
    Gotcha, been in a similar situation. The end result is you have to tell them the functionality is not supported. One last option would be to use the Site Policy to ask the user to confirm they are over 18. This will ask the user to agree to T&Cs when they first login. Obviously they can just click accept without being 18 but they could always just make up their age anyway. At least legally this assures them that the end user has agreed they are of age. – CloudJake Mar 07 '18 at 21:15
  • Thanks a lot, @jordan121sa, I asked and they agreed to remove this AC. – Nghi Ho Mar 08 '18 at 06:32

0 Answers0