backdrop-contrib / devel

Provides helper functions for Backdrop developers.
https://backdropcms.org/project/devel
GNU General Public License v2.0
10 stars 13 forks source link

Devel generate creates authenticated users with wrong role machine name #136

Closed argiepiano closed 1 year ago

argiepiano commented 2 years ago

When using devel to generate authenticated users, the saved roles are incorrect. See attached image. The generated user has two roles: authenticated (which is correct) and Authenticated (which is incorrect).

This produces notices when displaying roles in a View: Notice: Undefined index: Authenticated in views_handler_field_user_roles->pre_render()

I believe the issue is that devel_generate_users_form_submit() is passing an unfiltered roles array keyed by the machine names editor and administrator with 0 values (since the goal was to create authenticated users with no other role). This confuses the user save functions.

Proposed solution: do an array_filter and pass the resulting array_keys to devel_create_users().

Screen Shot 2022-03-26 at 8 29 51 PM
argiepiano commented 2 years ago

PR #137 ready for review.

quicksketch commented 1 year ago

Thanks @argiepiano! I merged #137!