New accounts: how to define City/State and Country as mandatory fields

New accounts: how to define City/State and Country as mandatory fields

by C S -
Number of replies: 3

Good afternoon

How can I put the City/State and Country fields mandatory when the user creates a new account?

These two fields are the only ones that, by default, come without mandatory filling. How can I become them mandatory?

Thank you in advance for your help
Average of ratings: Useful (1)
In reply to C S

Re: New accounts: how to define City/State and Country as mandatory fields

by Nusrat Shahid -

did you got any solution for that?

In reply to Nusrat Shahid

Re: New accounts: how to define City/State and Country as mandatory fields

by Chris Swinney -
We would like to know too smile 

TBH, we need to ensure users define their country and time zone. There is a tour that we provide that shows people where the timezone field is, but I would like to ensure this is set on account sign up.

I suppose the downside here is that ANY country or timezone could be set and there is no simple way to ensure that these are correct for the user.

  • Countries are important as this helps other internal teams manage users in their region.
  • Time zones are important as this allows users to see appointment bookings at their correct time (albeit it is not simple to set an appointment in a specific time zone as it defaults to the system time zone.
In reply to Chris Swinney

Re: New accounts: how to define City/State and Country as mandatory fields

by Jon Bolton -
Picture of Particularly helpful Moodlers Picture of Testers
It’s not possible to make those fields mandatory in core Moodle without altering the underlying code.

There is a workaround though - use the Associated Input plugin - https://moodle.org/plugins/profilefield_associated - and create custom profile fields.

As you say though, there is no way of validating the data input, but that’s also true for many other fields in the user profile.