I've experienced missing fieldsets/fields in user registration form on multilanguages sites.
Everything works fine when using default language (no prefix for lang in URL), but forms are incomplete when using other languages (with prefix for language in URL).
I reverted to 6.x-1.2 (patched with security fix http://drupal.org/node/559630) and it's working fine in all languages with 6.x-1.2
Bug has also been reported by someone else : http://drupal.org/node/709380
| Comment | File | Size | Author |
|---|---|---|---|
| #23 | 721228-23.profile_role.registration_form.patch | 844 bytes | ekes |
| #19 | profile_role-fieldsets_hidden_on_admin_create-721228-19.patch | 685 bytes | kscheirer |
| #15 | profile_role-721228-15.patch | 527 bytes | samuelsov |
Comments
Comment #1
Marat commentedI have a single website and have the same problem
Comment #2
hovering commentedI feel the same, no fields are shown in profile during registration.
Comment #3
tutumlum commentedThe problem persist because role of the user is not certain during registration of the user. So user should choose a role first. A module like registration_role_with_approval should be used, and according to roles selected, a multi-step registration may be in action :)
Comment #4
Anonymous (not verified) commentedIs there any hope to get this issue solved or should we downgrade?
"The problem persist because role of the user is not certain during registration of the user. So user should choose a role first. A module like registration_role_with_approval should be used, and according to roles selected, a multi-step registration may be in action :("
I did try this module with no effect at all to the other languages. The fields remain hidden. Please explain, did you manage to do it with the help of this module or is this just a theory?
All in all this is unwanted behaviour as anonymous user should be able to see the fields in the registration form(!) O_o
Comment #5
tutumlum commentedIn my test, when profile_role is enabled, profile fields in registration form is disappeared. It is an expected behavior because role of the user is not certain during registration of the user as I wrote before.
Yes it is just a theory. My solution is creating new module with a registration page with options of register student / parent / staff (see school_administration module) and handle profile fields in module... :(
Yes, using this way against anonymous users is an unwanted behavior. So there must be a registration page with some permissions, and a person with the required permissions should register the user...
Comment #6
Anonymous (not verified) commentedThanks for clarifying this. We are using Apply for role-module to grant permissions to users after they have registered so in a way it is a real relief that "registration_role_with_approval " does not help and thus is not needed.
We too downgraded to 6.x-1.2 (patched with security fix http://drupal.org/node/559630) and it's working fine in all languages with 6.x-1.2
This is just to confirm that downgrading works ok and is the best solution by far at this point.
Comment #7
mnestor commentedNot sure how correct this is. But on line 79 of profile_role.module
Change it from:
$roles = isset($form_state['post']['roles']) ? $form_state['post']['roles'] : array();
To:
$roles = isset($form_state['post']['roles']) ? $form_state['post']['roles'] : array('1'=>'anonymous');
And comment out or delete the "if" right above that. Allows you to set Profiles to the anonymous role for registration.
Comment #8
Obsidian1269 commentedDude, you were right on with that! I commented out the entire if statement above that (below the function start) and replaced the code and it works beautifully. I have another User_Types module that allows me to have multiple registration forms with various options based on the registration form hyperlink they are sent to. The user-type defines the various fields displayed and in conjunction with this module, it removes that information from the tabs in their respective profiles. Hooray!
Comment #9
steveOR commentedNeeded this fix and can also confirm now that mnestor's 2 code changes work!
Comment #10
OmarQot commentedActually this issue happens if you reach the register page with parameters in the url for example
/user/register?destination=xxxxxxxx
if you go to
/user/register
This issue will not appear.
To fix this issue you need to the following in the code in the profile_role_form_user_register_alter
function profile_role_form_user_register_alter(&$form, $form_state) {
$form_action = $form['#action'];
if(mb_strlen($form['#action']) > 14)
{
$form_action = (mb_substr($form['#action'],0,14));
}
//if ($form['#action'] == '/user/register') {
if ($form_action == '/user/register') {
// No way to determine what role user will be, so leave form alone.
return;
}
... continue the function with any other changes
Regards,
Comment #11
bartezz commentedDoes my patch resolve this?
http://drupal.org/node/924116
Comment #12
Anonymous (not verified) commentedNot sure to understand...
I've applied the fix of comment #7.
Now, every custom profile fields I've created before show up on the registration page. For eg. : A fax number field shows up on the "role 1" page but it should only shows up on the "role 2 page"...
I only want to display the profile fields corresponding to each role on the registration page.
I forgot to say that I also use the Auto-assign Role module. How can I do to have different registration pages depending on roles (paths ?)
Is it finally possible without the Content profile module ?
Thank you ;)
Comment #13
j0e commented@bumathan, see comment #17 at http://drupal.org/node/431454
you don't need to set anything to display for anonymous user from this issue thread,
the patch there integrates auto assign role with profile role for registration...
Comment #14
Anonymous (not verified) commentedThank you j0e :-)
Comment #15
samuelsov commentedAs mentionned by OmarQot on #10, the issue appears only when you have arguments in the url after /user/register.
I have made a simple patch which work fine for me.
Please review and comment.
Comment #16
bartezz commented@samuelsov,
Better solution in patch here http://drupal.org/user/284019
This patch takes care of lang prefixes (/nl) but also removes the possible problems with arguments suffixing the url...
Cheers
Comment #17
samuelsov commentedThanks for your feedback Bartezz, but the patch is missing.
I suppose you meant : http://drupal.org/node/924116#comment-3498508.
In this case, yes, i tested it and it's much better than my patch.
Comment #18
bartezz commentedOops, wrong url idd... Good you found it anyway. Could you mark the other post as reviewed and tested, thanx!
Cheers
Comment #19
kscheirer#7 is not quite right either - you could use a default array
array(2 => 'authenticated user')since you're always going to create an authenticated user, but that's not the real problem.This issue (and several others) have pointed it out already - using
$form['#action'] == '/user/register'is very bad. It doesn't handle arguments in the url at all and won't work with i18n and there's just no reason to use the form action in a test like that. I think the intent of this block of code can be expressed as "Dont mess with the form when registering new users."The patch in http://drupal.org/node/924116#comment-3498508 checking
$form['form_id']['#value'] == 'user_register'is useless too - the function hook is hook_form_FORM_ID_alter(), in this caseprofile_role_form_user_register_alter(), so they're always going to match, essentially removing this function. I'm not claiming this doesn't work for some people, since it does prevent fieldset removal, just that it only works by disabling the function, not because its a real fix.I think the best solution is to change the initial if block to
is_null($form['#uid']). $form['#uid'] will be null when creating a new user. I think it'll be defined when looking at an existing user, but haven't verified that. The attached patch makes this change.I can into this problem not when registering, but when creating new users as an admin. It's still the
user_registerform, but the action and url is atadmin/user/user/create.Not much hope of getting this in though - D6 versions of profile modules are not going to get much maintenance love :D
Comment #20
Anonymous (not verified) commentedThis module broke the alteration of my registration form as well.
Instead of checking for
$form['#action'] == '/user/register'it think you should check for$form_id == 'user_register'like Content Profile Registration does.Comment #21
kscheirerAs I stated above, the hook being used is hook_form_FORM_ID_alter(). In this case that's profile_role_form_user_register_alter. So the FORM_ID part is user_register. So the check to make sure $form_id == 'user_register' is already in the function definition.
Comment #22
ekes commentedThis form_alter doesn't actually seem to make a huge lot of sense. Please correct me if I'm wrong, I'm just working on a site where this module has been previously installed, but I say this because:-
I assume this is why the solution of checking
$form_id == 'user_register'is popular above, it always returnTRUEhence the form_alter does not run on the registration form at all.Is there a use case for removing for profile fields from the registration form, when you can choose that they are there in the first place? If not, is it not better to remove this function?
Comment #23
ekes commentedAnswering myself. Everything is correct. Except there is a use case for removing the fields from the administration admin/user/user/create form.
Senario: Profile fields are put on registration form for the default user role of a first registering user on the site (remember this need not be authenticated user). There are other roles with different profiles that can be created by administrators.
Fine, but confusing, for admins if the registration form user role profile fields are present on the admin version of the form. However, not only confusing but impossible any of those fields are compulsory.
Solution: While detecting where the form is being show (as proved above) is brittle; and difficult. Only a user with 'administer user' privs can select chose role; they are also the only users who can access the admin version of the form. Swap out the path check, for a user access check.
Comment #24
solomonkitumba commentedyou can solve this by installing the profile2 module 2 https://drupal.org/project/profile2 ...what it does is that it allows you to add custom fields on the user registration form