We need to use the "Create user" option in Contextual Admin, but the user role settings are causing a conflict for us. The module allows for default roles and altering of roles, but what we need is Contextual Admin to support the functionality we already have in place with the Role Delegation module.

We've written a patch to add support for Role Delegation that I will attach for review. It will also require a patch to the Role Delegation module since Contextual Admin writes its own user_register_form function.

When writing this patch, we also realized the context_admin_user_edit_form is really overkill, since it essentially is a copy of user_account_form with a few changes for #access. Rather than copying/pasting the entire user_account_form function into Contextual Admin, we pull the user_account_form and make modifications to support the differences we see in user_create_menu.inc.

Also made some updates to replace #dependency with #states, as is the newer way to control visibility.

I'll post the patch for review in a few minutes.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ron_s created an issue. See original summary.

ron_s’s picture

Status: Active » Needs review
FileSize
14 KB

Attached is a patch for review. I will add a link to the Role Delegation patch once it has been posted. Both patches will be needed to have this functionality work.

ron_s’s picture

Here is a link to the Role Delegation patch necessary to support Contextual Administration: https://www.drupal.org/node/2700759#comment-11042391

kevinsbath’s picture

Hi Ron,

Thanks for the patches. One quick comment - you're checking the value of $page['handler']->conf['context_admin_user_roles_option'] before checking if it's set - causing an Undefined index: context_admin_user_roles_option in context_admin_user_create_menu_form_alter() (line 255 of context_admin/plugins/context_admin/user_create_menu.inc).

I'm afraid I don't quite understand what this function logic is trying to do - so can't fix - but through I'd let you know anyway.

Kind regards - Kevin.

ron_s’s picture

Kevin, thank you for taking time to review the patch and provide feedback.

Yes, you are right... there is a bug. However I believe it's actually earlier in the process. We should not need an isset in the form_alter, because the value should be either context_admin or role_delegation once it reaches that point.

The issue is in the #default_value of the form, which was set as array('context_admin') when no value exists, but should be 'context_admin'.

Try the attached patch and let me know if there are further issues. Thanks.