I created a new field that I only wanted to show for a certain group of users. I installed the module, enabled the module, enabled the cck node type I wanted to control, chose the field I wanted to limit, then enabled all permissions for the particular group I wanted to have editing that particular field. However, when I logged in as a user in one of the other groups, the field still displayed. What am I missing?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dzynz’s picture

I also have this problem with 5.1. CCK perms also give me sql errors.

horizens’s picture

Version: 4.7.x-1.1 » 5.x-1.4

I too am having problems with the fields showing even though I set up everything correctly. I'm using 5.1.

horizens’s picture

Oh, I think I found part of the problem. I'm trying to hide the field in a view. If the content type is on it's own then it works fine. Is there a work around?

arthurf’s picture

Status: Active » Fixed

5.1.5 should fix this issue, please update to this version.

arthurf’s picture

woops, make that 5.1.6

sanyi’s picture

Version: 5.x-1.4 » 5.x-1.7

I am not sure if this is fixed or not. I made 2 fields,only 1 is viewable by guest which i set admin/user/access
Then I logout and I could still see 2 fields.

sanyi’s picture

Status: Fixed » Active

The status shows that its fixed, I redownload the whole pakage and it is still not working for me. So, I set it back to active. I am sorry if it has been fixed.

sanyi’s picture

Version: 5.x-1.7 » 5.x-1.8

still does not work using version 5.x-1.8

nbayaman’s picture

Confirm.
Fields sill showing. Though, fields are hidden while editing a form.

Module version is 5.x-1.8

bchoc’s picture

Another concurrence. I can block field write permissions, but not read permissions. 5.1, 1.8.

Jensor’s picture

Confirm, the problem is still active.

nbayaman’s picture

Pls fix it ^^ :)

gaele’s picture

Category: support » bug
Priority: Normal » Critical

Confirmed. Right now the module doesn't do what it's supposed to do.

oprior’s picture

It's not working for me either.

Question: can I safely rollback to the previous version?

nbayaman’s picture

Which version does work?

munga’s picture

Ok, This bug is annoying a lot. I had a look at the code but I'm a bit lost.

as far as I understand the problem should be in the function cck_field_perms_nodeapi
but it seems that this function is never called (I just tried to print something at the beginning
of the function). Can anybody give me a quick explanation of how this module is supposed
to restrict visibility of a certain field ?

cheers.

huayen’s picture

I am using 5.x-1.8 on two of my sites, one is working, but the other has the same problem as discussed here. I am really confused why this happen. Hope this problem will be solved soon.

nbayaman’s picture

huayen, which modules do you use on "working" site? And which ones on another?

munga’s picture

The problem is in cck_field_perms_nodeapi

foreach ($disallowed_fields[$type] as $disallowed_field) {

should be

foreach ($disallowed_fields[$type] as $disallowed_field => $a) {

or something similar as _cfp_content_to_readable is interested only about the keys and not the values
of the array. I think the same goes for _cfp_form_helper

If this works I'll roll a proper patch.

freeman-1’s picture

Tried the " => $a" suggested in comment #19, doesn't work for me. I'm running v1.8 on a pretty new test site with 5.1.

1st-angel’s picture

hi,
you have to change the line from
foreach ($disallowed_fields[$type] as $disallowed_field){
to
foreach ($disallowed_fields[$type] as $disallowed_field => $value){
and add a line
if($value==0){continue;}
as the first statement inside the block.
The whole block than looks like this:

foreach ($disallowed_fields[$type] as $disallowed_field => $value) {
            if($value==0){continue;}
            if (!(user_access(_cfp_content_to_readable($type, $disallowed_field, "view")))){     
              unset($node->$disallowed_field);
              unset($node->content[$disallowed_field]);        
            }   
          }
freeman-1’s picture

Thanks, it works. I've also amended the similar snippet in the _cfp_form_helper function - so the edit forms work as well. Nice.

munga’s picture

Component: Miscellaneous » Code
Status: Active » Needs review
FileSize
1.86 KB

the patch.

ac’s picture

patch applies and works with 5--1-8. Please commit.
Thanks

Jensor’s picture

Patch works for me too, thanks.

oprior’s picture

Thanks everyone, can we get a new release for all us Noobs who can't apply patches?

jarea’s picture

I just added the patch to 1.8. I have a CCK field that is a set of radio buttons. Turned off the view field permission (and all other permissions) for anonymous and registered users and then tried to add a node. The field still shows up and can be modified.

jarea’s picture

Sorry - cancel that last comment. I had just made the edit suggested a couple of posts back and not applied the entire patch. Applied the full patch and all seems to work fine now.

Thanks!

Ryan Palmer’s picture

After applying the patch, I am still having the same issue.

All related modules are the most recent versions... I cant find any other reason for this not to be working!

Cayenne’s picture

Same problem here. Manually applied patch and am getting unauthorized view of textfields with phone numbers and the like.

If there's anything an amateur can do to help, please let us know!

Cayenne’s picture

Title: field still showing for all users » Workaround for My Site: It works well enough

After starting with a simple one-field node type, I discovered the following:

Using the patches above, I was able to get the module to work when APPLIED TO FIELDS OUTSIDE A GROUP.

The fields I wanted to hide, I simply moved out of a group and used the weights to get them in the proper order. Not perfect, but it works enough for me.

Still hoping for a total fix!

yched’s picture

Title: Workaround for My Site: It works well enough » field still showing for all users

Maybe related to the fieldgroup stuff - we committed this in latest -dev CCK a few days ago.
I had second thoughts afterwards, but for now it's still in.

+ when you change a title in the issue queue, it changes the title of the whole thread :-)

arthurf’s picture

Status: Needs review » Fixed

Patch from munga has been applied, along with some code cleanup. I hope to resolve some of the issues with field groups, however because field groups have changed over time with CCK, my aim is only going to be on the latest CCK versions.

neurojavi’s picture

Version: 5.x-1.8 » 5.x-1.9

Hi:

I've downloaded, installed an properly configured the last version of the module (5.x.1.10) (not available in the version box yet :-( )
And it seems to do nothing... All roles (included anonymous) can see the restricted fields and roles with edit permissions can see and edit fields.
I have all checkboxes in the module section of admin/user/access disabled, so in theory, only superadmin could see the fields...
This version seems to have the patch from munga applied but it doesn't seem to work for me.
Anybody else?

Many thanks.-

arthurf’s picture

Hi neurojavi-

Can you send me a screen shot of your admin/user/access screen for cck_field_perms? I ask because I'm using it without the experience that you're describing here.

thanks

neurojavi’s picture

FileSize
120.25 KB

Hi:

Here is the screenshot

Thanks.-

Jensor’s picture

I had to confirm the problem too.

The new Version 5.x-1.10 doesn't work for me too. I will use the 5.x-1.8 with the patch, till the problem is solved.

arthurf’s picture

Status: Fixed » Postponed (maintainer needs more info)

What version of CCK are you using? I've been testing against 1-4, but I haven't tested against 1-5 yet which maybe the source of the issue?

arthurf’s picture

Version: 5.x-1.9 » 5.x-1.10

also, can you let me know if you have the field group module on?

neurojavi’s picture

Hi arthurf:

I'm using cck-5.x-1.5 and the field group module is DISABLED.

Hope this helps...

Javi.-

arthurf’s picture

Can you try turning on the field group module? I think that I have to require the field group module to make things work.

neurojavi’s picture

Hi:

I've enabled the field group module and doesn't appear to be any change.
I'm still seeing the fields with a user without any permissions to see those fields.

Thanks.-

neurojavi’s picture

Status: Postponed (maintainer needs more info) » Active

just changing state...

walterhoct’s picture

Title: field still showing for all users » Problem with field groups

With the latest version(5.x-1.10), the access control for each individual field seems fine. However, it doesn't work when I tried to hide a complete group without checking each individual field. Not the way it's supposed to work, with the text "Checking this box will hide this complete field group" under the checkbox for the group.
This is definitely a very useful and powerful module. But the defect is not minor.
Any plan to fix this bug?

mornel’s picture

well I played around w/ group issue. It seems that the problem is that if at least one filed from a particular group is hidden the whole group will not be displayed. Check the 404 line in /modules/cck/fieldgroup.module. For now I've commented this part from 404 to 407...

Hope this will guide you to proper patch ;)

samlogan’s picture

Did anyone resolve this issue yet?

Thanks.

interestingaftermath’s picture

This is SUCH a major defect. It makes the module unusable for most cases. I am unable to check all 6 fields because I get a PHP memory error (my php memory limit is 96). That's no good.

Not sure what I am going to do...