Cannot hide 'city' and 'country' in registration form

Cannot hide 'city' and 'country' in registration form

by Sebastian Vencken -
Number of replies: 7

Hi, for some reason Custom CSS in the Snap theme has me completely confused. I've manged to use {display:none;} to hide the input fields for City/town and Country in the user registration form. However, I cannot seem to hide the labels.


I've tried all kinds of combinations using the div ID or class, but it simply does not hide them.

The code that worked for hiding the input fields is

#id_city{display: none;}
#id_country{display: none;}

Would anybody know the CSS code to hide the labels?

Thanks


Average of ratings: -
In reply to Sebastian Vencken

Re: Cannot hide 'city' and 'country' in registration form

by Sebastian Vencken -

Some images to illustrate the issue.


Signup page


In reply to Sebastian Vencken

Re: Cannot hide 'city' and 'country' in registration form

by Ken Task -
Picture of Particularly helpful Moodlers

You might look into the language packs for your site.

What you are seeking is nothing more than a 'label' (not the same as the label content resource in the Moodle UX/Admin UX).

Haven't looked myself but if it's anywhere ... it's in language customizations ... I think!

'spirit of sharing', Ken

In reply to Ken Task

Re: Cannot hide 'city' and 'country' in registration form

by Sebastian Vencken -

Thanks Ken, I'll have a look. However, I'm keen to remove the city and country functions from the signup.php form altogether. So far, any advice given in previous threads are either modifications to signup.php (which can lead to issues with updating the site) or using Custom CSS in the theme settings. I've managed to get half-way with the latter method, but cannot seem to completely remove these fields.

In reply to Sebastian Vencken

Re: Cannot hide 'city' and 'country' in registration form

by Ken Task -
Picture of Particularly helpful Moodlers

Suggested language ... more specifically ... language customization is what you need to check.

I'll let you seek on your own site ... but just to check if I was right, I did access a 3.4.highest site and checked into language customizatons.

There are 4 hits on 'country' and all are core.  You've already pointed out that you know hacking core code is not a good idea (issues with updates as well as upgrades).

Right about now, considering that GDPR is soon to go into affect

(see: https://www.eugdpr.org/ and you can find a discussion here in these forums as well)

that moodle core ... by hook, or crook, or hack, or etc. would be discussed/shared, etc. *IF* the site is to be used by persons from EU.  Matter of fact, code is being added to Moodle to help admins comply with GDPR.

Why?  Am curious ... you don't have to answer of course!

'spirit of sharing', Ken


In reply to Ken Task

Re: Cannot hide 'city' and 'country' in registration form

by Sebastian Vencken -

Thanks for checking. I had a look. The language customisation would be a good option to change these fields. However, I'd like to completely remove them. I'll use your tip for other parts of the site though.

In reply to Sebastian Vencken

Re: Cannot hide 'city' and 'country' in registration form

by Olumuyiwa Taiwo -
Picture of Plugin developers

You should be able to use the :nth-child() CSS selector.

Something like (depending on the position of the city/town field)

#page-login-signup .form-group:nth-child(5) {
display: none;
}


Average of ratings: Useful (2)
In reply to Olumuyiwa Taiwo

Re: Cannot hide 'city' and 'country' in registration form

by Sebastian Vencken -

Excellent tip and it worked!

I've adjusted the code a little as using just the form-group class also deleted the Create My New Account and cancel buttons (also in form-group class). Hence, I've put form-group in as a subclass to the fcontainer class.

This now works perfect:

#page-login-signup .fcontainer .form-group:nth-child(5) {
display: none;
}
#page-login-signup .fcontainer .form-group:nth-child(6) {
display: none;
}

Still a mystery why the #id selectors didn't work initially.

Average of ratings: Useful (1)