administerusersbyrole_form_user_form_alter() doesn't check if the elements it alters actually exist.

For example we have a custom user form (mode) that doesn't expose the account mail nor roles elements.

This results in PHP warnings like:

Notice: Undefined index: account in administerusersbyrole_form_user_form_alter() (line 223 of modules/contrib/administerusersbyrole/administerusersbyrole.module).

CommentFileSizeAuthor
#2 3056097-2.patch1.1 KBcasey

Comments

casey created an issue. See original summary.

casey’s picture

Status: Active » Needs review
StatusFileSize
new1.1 KB
adamps’s picture

Status: Needs review » Reviewed & tested by the community

Thanks @casey the patch looks good. I will commit it next time I am working on the module.

  • AdamPS committed 8658da7 on 8.x-3.x authored by casey
    Issue #3056097 by casey, AdamPS:...
adamps’s picture

Status: Reviewed & tested by the community » Fixed

Thanks

I made a minor change for simplicity and consistency

isset($form['account']['roles'])

instead of

isset($form['account']['roles']['#options'])

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.