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.
Hi,
I have a field in my content type and i want that field value to Edit/Create by two roles i.e. "administrator" and viewable only by "tester", so, it should not be display for administrator.If administrator has another role "tester", then it should be display for him , else not at all.
I have done, I have given field view permission to tester and not administrator, but still it's viewable by administrator.
Please see to it.
Thank you.
Comments
Comment #1
David Stosik CreditAttribution: David Stosik commentedIf by "administrator" you mean user 1, then it is not a bug. Whatever you do, user 1 will have all permissions granted, and be able to see all fields, that's a choice deep in Drupal core.
If by "administrator" you mean the "administrator" role created on Drupal installation, the one that is set as "Administrator role" in "Account settings" (/admin/config/people/accounts), then it is also normal.
If that's not the case, then please explain a bit more and I'll have a look.
Thanks,
David
Comment #2
vishy_singhal CreditAttribution: vishy_singhal commentedI have been reading a lot of forums and comments about the module does not work for admin pages.
I looked at some of the common codes and found that the following line used in a JS was creating problems.
REPLACE >> $('table#permissions').once('permissions', function () {
BY >> $('form#user-admin-permissions table#permissions').once('permissions', function () {
Comment #3
maxilein CreditAttribution: maxilein commentedWhich problems do you mean?
After changing these lines, will it work on Admin pages?
Comment #4
David Stosik CreditAttribution: David Stosik commentedI'm sorry but your jQuery selector looks wrong. An HTML element cannot have two ids, so using the # sign twice is probably an error.
Can you please describe your problem more precisely, and explain what did you meant by "administrator" in your first post?
Regards,
David
Edit: misreading, I didn't see a space, the selector does not look wrong, sorry about that.
Comment #5
vishy_singhal CreditAttribution: vishy_singhal commented@maxelein - Yes it will work. I have tested it out successfully.
Comment #6
David Stosik CreditAttribution: David Stosik commentedIsn't this code breaking anything, especially on non admin pages?
Thank you,
David
Comment #7
vishy_singhal CreditAttribution: vishy_singhal commentedThe code works perfectly fine. I have tested in on many pages.
Comment #8
mariacha1 CreditAttribution: mariacha1 at ThinkShout commentedI'm inclined to close this due to the changes between beta1 and beta2 -- not sure it's still relevant.