General developer forum

How to remove user's field when creating or editing users' profile

 
Picture of Worawat Lawanont
How to remove user's field when creating or editing users' profile
 

Hi all,

 

I'm trying to remove unnecessary field from creating user page and editing profile page, most of them are in optional section, such as, AIM, MSN.,

 

Are there anyway to do so (including editing the code)?

I need a guideline.

 

Thanks a lot in advance smile

 
Average of ratings: -
Picture of Shashikant Vaishnav
Re: How to remove user's field when creating or editing users' profile
 

Hello Worawat,

 

You may override useredit_shared_definition() method in /user/editlib.php file. Or either you may directly comment the header containing Optional fields.

    /// Moodle optional fields
  //  $mform->addElement('header', 'moodle_optional', get_string('optional', 'form'));

 

Good luck,

Shashikant

 
Average of ratings: -
Picture of Julio Fernández Avancini
Re: How to remove user's field when creating or editing users' profile
 

Hi, it is possible to do this without modify the source? Just the theme or something like that? (in Wordpress functions.php) So when it upgrades I won't loose anything. And how to hide Additional names? I really don't understand about this.

Thanks in advance.

 
Average of ratings: -
Picture of Jon Bolton
Re: How to remove user's field when creating or editing users' profile
Group Particularly helpful MoodlersGroup Testers

In your custom CSS, add...

div#fitem_id_icq {display: none;}

div#fitem_id_skype {display: none;}

div#fitem_id_aim {display: none;}

div#fitem_id_yahoo {display: none;}

div#fitem_id_msn {display: none;}

fieldset#id_moodle_additional_names {display: none;}

 
Average of ratings: Useful (9)
Picture of Julio Fernández Avancini
Re: How to remove user's field when creating or editing users' profile
 

Thanks you!

 
Average of ratings: -
Picture of DeLoy Wilkins
Re: How to remove user's field when creating or editing users' profile
 

Thanks John !!

 
Average of ratings: -
Picture of Debbie K
Re: How to remove user's field when creating or editing users' profile
 

Many thanks Jon!

 
Average of ratings: -
Picture of Sidd Lep
Odgovor: Re: How to remove user's field when creating or editing users' profile
 

Thank you, Jon.

This worked for many of optional fields, except for web page, ID number, phone and mobile phone. 

This is the code I wrote:


div#fitem_id_web_page {display: none;}

div#fitem_id_id_number {display: none;}

div#fitem_id_phone {display: none;}

div#fitem_id_phone_number {display: none;}


So, is this code correct or I made some mistakes.

And, is it possible to hide all "optional" section by one line of code, instead of writing the line for each of the optional fields.


Thank you.



 
Average of ratings: Useful (1)
Picture of Jon Bolton
Re: Odgovor: Re: How to remove user's field when creating or editing users' profile
Group Particularly helpful MoodlersGroup Testers

Should be:

div#fitem_id_url {display: none;}
div#fitem_id_idnumber {display: none;}
div#fitem_id_phone1 {display: none;}
div#fitem_id_phone2 {display: none;}


To hide ALL optional fields:

fieldset#id_moodle_optional {display: none;}


 
Average of ratings: Useful (5)
Picture of Łukasz Sanokowski
Odp: Re: Odgovor: Re: How to remove user's field when creating or editing users' profile
Group Plugin developers

Thank you Jon, it's awesome solution in its simplicity. What is the code to hide "City/town" and "Timezone" fields on the same page?

 
Average of ratings: -
Picture of Jon Bolton
Re: Odp: Re: Odgovor: Re: How to remove user's field when creating or editing users' profile
Group Particularly helpful MoodlersGroup Testers
div#fitem_id_city {display: none;}
div#fitem_id_timezone  {display: none;}
 
Average of ratings: Useful (4)
Picture of William Bergman
Re: How to remove user's field when creating or editing users' profile
 

Hello,


I would like to create a certificate that will display individual "code" per student.  I had planned to use the ICQ field and hide the field.  After hiding the field it is also hidden from the certificate.  Is there a way to remove the field from the "Edit Profile" page and leave it visible to the certificate plugin?  Moodle 3.3.1 using Custom Certificate Plugin 

Custom certificate
mod_customcert
3.3 release (Build: 2017050508)
2017050508
This is quite urgent, any assistance would be greatly appreciated.



 
Average of ratings: -