How to eliminate the "Country" field on the signup page

How to eliminate the "Country" field on the signup page

by Albert Leatherman -
Number of replies: 8

Hi, I'm using the great evolve-D theme with Moodle 3.1. To eliminate the "Country" field on the signup page of my Moodle, I've tried inserting

#id_country{display: none;} 

at Site Administration > Appearance > Themes > evolve-D > General Settings > Custom CSS, but doing so only eliminates the dropdown menu, not the word "Country" and the red asterisk beside it. I've also tried inserting 

#page-login-signup .fcontainer .form-group:nth-childNo {display: none;}

where n is any one of various numbers I've inserted, but that eliminates neither the dropdown nor the word "Country" with the red asterisk.

Any other ideas on how to get rid of that field when a user signs up?

Thanks.

Average of ratings: -
In reply to Albert Leatherman

Re: How to eliminate the "Country" field on the signup page

by M. Degrange -
Try :

#page-login-signup #fitem_id_country {display:none;}
In reply to M. Degrange

Re: How to eliminate the "Country" field on the signup page

by Albert Leatherman -

Thanks for the idea. I tried it and it worked cosmetically but unfortunately it broke the signup form, which people can't submit without the required "Country" field. So I deleted some lines of code in /login/signup_form.php that refer to country and that did the trick smile

In reply to Albert Leatherman

Re: How to eliminate the "Country" field on the signup page

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
If you upgraded to a less ancient version of Moodle you would find that Country is no longer a required field.
Average of ratings: Useful (1)
In reply to Howard Miller

Re: How to eliminate the "Country" field on the signup page

by Albert Leatherman -

I’d love to, but a lot of time and money have been invested in our highly customized Moodle site, including customization to numerous php files. Is there a way to upgrade without losing those customizations?

In reply to Albert Leatherman

Re: How to eliminate the "Country" field on the signup page

by M. Degrange -
Having an outdated version is always dangerous because you don't have access to vulnerability fix. So someone might use these vulnerability to do nasty things. I don't know the answer for your question "Is there a way to upgrade without losing those customizations?".

A solution could be to add custom javascript to automatically fill the field.
Average of ratings: Useful (1)
In reply to Albert Leatherman

Re: How to eliminate the "Country" field on the signup page

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
And this... is exactly why you should not customise core files sad

Yes and no - firstly, I hope you used a version control system to track your changes. If not, you will have to get *exactly* the non-modified version of the Moodle code and make a diff. You can then apply this diff to a new version of Moodle and then spend hours and hours fixing all the problems this will introduce. It's probably quicker to take a clean copy of 3.8 and write all new plugins to create your functionality.
In reply to Albert Leatherman

Re: How to eliminate the "Country" field on the signup page

by Jon Bolton -
Picture of Particularly helpful Moodlers Picture of Testers

If you’re not interested in the user’s country, you could set the default country (https://docs.moodle.org/31/en/Location) to any one of your choices and then use the css above to hide it on the sign up page. That way everyone will have a country stored in their profile so it won’t break the requirement to have one.

I would go one further with the css though, and just use 

#fitem_id_country {display:none;}

which will remove it from the signup page and the user profile page.

Average of ratings: Useful (1)
In reply to Jon Bolton

Re: How to eliminate the "Country" field on the signup page

by Albert Leatherman -

That’s a good idea to set a default value! Thanks a lot Jon.