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

Priority:Critical» Normal
Status:Active» Postponed (maintainer needs more info)

If 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

I 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 () {

Which problems do you mean?
After changing these lines, will it work on Admin pages?

BY >> $('form#user-admin-permissions table#permissions').once('permissions', function () {

I'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.

@maxelein - Yes it will work. I have tested it out successfully.

Isn't this code breaking anything, especially on non admin pages?
Thank you,
David

The code works perfectly fine. I have tested in on many pages.