Posted by BaderEX on November 14, 2012 at 8:13pm
Gents,
I'm having issues with user account registration. Most of our users are using the website from corporateintranet and the corporate has firewall with block any web page has a form with enctype attribute defined.
the user module is defined as follow:
my question is how modify the form to be without enctype
The form registration does not contain any file fields as well as the user profile picture is disabled in the admin panel! Please advise we are facing serious issues a many of our users are not able to register due to this issue!
Thank you very much
Comments
hook_form_alter
Even though you have the user picture turned off, the user_account_form( ) still adds the picture file field to the form array. See http://api.drupal.org/api/drupal/modules%21user%21user.module/function/u...
You should be able to use a hook_form_alter() on user_register_form to remove $form['picture']['picture_upload'] or just $form['picture']. I think that will solve your problem.
Thank you for your quick
Thank you for your quick reply!
I added the following to user.module
function user_register_alter($form, &$form_state) {
unset($form['picture']);
}
but I still get the enctype issue!
Please advise!
Thanks
Custom module
First, do not modify any core modules such as user.module or any files not under sites/ directory. This is a bad practice. The files will be overwritten when a core update occurs.
Hooks should be implemented in your own custom module. You should create a custom module in sites/all/modules/mymodule (for example).
mymodule.info:
name = My Custom Moduledescription = My custom changes
core = 7.x
mymodule.module:
<?php
/**
* @file
* Provides customized changes to this Drupal installations
*
*/
/**
* Implements hook_form_FORM_ID_alter().
*/
function mymodule_form_user_register_form_alter(&$form, &$form_state, $form_id) {
unset($form['picture']);
}
For more information, see "Creating modules - a tutorial: Drupal 7.x" (http://drupal.org/node/1074360)