Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
It would be nice to have the ability to limit which roles a user can select from when using the 'User Create' content from context admin. I've created a patch for this feature. I will attach it in the comments below.
Comment | File | Size | Author |
---|---|---|---|
#9 | limit_roles-1953646-9-interdiff.txt | 693 bytes | Steven Brown |
#8 | limit_roles-1953646-8.patch | 5.07 KB | Steven Brown |
#1 | limit_roles-1953646-1.patch | 4.99 KB | Steven Brown |
Comments
Comment #1
Steven Brown CreditAttribution: Steven Brown commentedAttached Patch
Comment #2
Steven Brown CreditAttribution: Steven Brown commentedBecause I've switch the 'Alter Roles' form element from a Checkbox to Radios, I've added a third option to the radios called 'Disallow' which will not allow the user to edit the roles that can be given.
I only did this because there isn't a way to reset the radio button on the form so in case someone wanted to go back to the default with out creating it from scratch.
Comment #3
cdracars CreditAttribution: cdracars commentedApplied the patch twice...
checking patch plugins/context_admin/user_create_menu.inc...
warning: plugins/context_admin/user_create_menu.inc has type 100755, expected 100644
Applied patch plugins/context_admin/user_create_menu.inc cleanly.
Received this message both times however it seems the patch did work as expected, radio buttons worked fine. Not sure about the warnings though... maybe just me :)
Comment #4
Steven Brown CreditAttribution: Steven Brown commentedNot sure why you are getting the warning. I git cloned the 7.x-1.x branch and applied the patch.
Checking patch plugins/context_admin/user_create_menu.inc...
Applied patch plugins/context_admin/user_create_menu.inc cleanly.
I didn't get the type issue. Not sure what that issue is OR if it is an issue.
Comment #5
Steven Brown CreditAttribution: Steven Brown commentedComment #6
realityloopapplied to stable without issue, works as advertised.
Comment #7
EclipseGc CreditAttribution: EclipseGc commentedIf we can't get states working on this, can we get ctools dependent? We don't need to be showing this if they're not selecting limited.
In general I really like what you're attempting to do here, let's get this working and see how it goes from there.
Eclipse
Comment #8
Steven Brown CreditAttribution: Steven Brown commentedAlright I tried using FAPI #states and it wouldn't work for me in the page manager page but it would for a FAPI form... So as suggested by EclipseGc I've used Ctools dependency option instead.
Comment #9
Steven Brown CreditAttribution: Steven Brown commentedAdded the interdiff between the two patches. Thanks EclipseGc for that tidbit :)
Comment #10
EclipseGc CreditAttribution: EclipseGc commentedcommitted to 7.x-1.x, I'll tag a release shortly for 1.2.
Eclipse
Comment #11
EclipseGc CreditAttribution: EclipseGc commentedWe should probably try to backport this to D6.
Comment #12
EclipseGc CreditAttribution: EclipseGc commented