Download & Extend

Categories used by "authenticated user" role do not appear on admin/user/user/create

Project:Profile role
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

I use Profile Role and I need all the fields in my user profile category "Primary Contact Information" to be displayed in the administrator's Create User form, since it is a category of profile fields that all users of the site share. All the fields in that category have the "Visible in user registration form" checkbox checked, but I also made sure that the Profile Role module knew that this profile category was used by all authenticated users by selecting "authenticated user" in the list of roles for the "Primary Contact Information" category.

To my dismay, however, none of the fields in this category appeared on the administrator's user creation form (Drupal URL /admin/user/user/create), despite the fact that the "authenticated user" role was preselected on the user create form. Profile Role failed to display profile categories that were associated with the "authenticated user" role when it altered this form.

So I checked the code for profile_role_form_user_register_alter and I noticed that, if the form has no post variables (i.e. the first time the form is rendered), the default initial list of roles is empty. This behaviour is incorrect, since all registered users will always belong to the "authenticated user" role.

The correct initial value for the $roles variable when no post variables are available should be array(2=>2), not array().

nobody click here