I use CCK Groups as a way of organizing how my edit pages are laid out. However, when I try and hide fields that are within the groups from editing, nothing happens. Is this what is meant by "groups are not supported", and, if so, are there any plans to implement groups in a future release?

Comments

infojunkie’s picture

Version: 6.x-1.1 » 6.x-1.x-dev

When you say "nothing happens", do you mean:
1) the fields are still editable
2) the fields don't show up at all
3) something else?

CCK Groups are supported in the latest dev version. Note that this version changes the data model so you'll need to update.php. I also recommend taking a backup of you DB before upgrading because only I did the testing.

demonix’s picture

The fields are still visible, and they are still editable.

infojunkie’s picture

Thanks for the clarification. I'm waiting for your feedback about the dev version.

demonix’s picture

Alright, looks like the fields no longer appear. However, two issues.

First, the fieldset still shows up (Nothing is in it, but it's still there). Second, nothing shows up, even for groups with permissions to edit something.

infojunkie’s picture

* Fieldset still appears: yes, that's on my TODO list
* Nothing shows up: that's more serious! It would be helpful if you could copy here the contents of your database table {workflow_fields}. This contains the permissions for each workflow state. And with it, please let me know which state and which group is not working as it should.

demonix’s picture

Yay for beta testing! Below is the table, I tried to clean it up as much as possible. However, Drupal doesn't like it. >.> Can you work with how it is now, or should I take a screenshot of it?
As for the state that isn't working, I have a state called "Published" (sid 5) that should allow my writers to edit only one thing. Instead, it hides all fields from everyone now (although everything can still be seen when not being edited).

Hope this helps!

sid name type visible_roles editable_roles
1 field_replay_explain game_review 4,-1 4,-1
1 field_alt_opinion game_review 4,-1 4,-1
1 field_replay game_review 4,-1 4,-1
1 field_value_explain game_review 4,-1 4,-1
1 field_value game_review -1,4 -1,4
1 field_audio_explain game_review 4,-1 4,-1
1 field_story_explain game_review 4,-1 4,-1
1 field_audio game_review 4,-1 4,-1
1 field_story game_review -1,4 -1,4
1 field_comm_explain game_review 4,-1 4,-1
1 field_graphics_explaination game_review 4,-1 4,-1
1 field_community game_review -1,4 -1,4
1 field_graphics game_review 4,-1 4,-1
3 field_audio_explain game_review 4,-1 4,-1
3 field_story_explain game_review 4,-1 4,-1
3 field_audio game_review 4,-1 4,-1
3 field_story game_review 4,-1 4,-1
3 field_comm_explain game_review 4,-1 4,-1
3 field_graphics_explaination game_review 4,-1 4,-1
3 field_community game_review 4,-1 4,-1
3 field_graphics game_review 4,-1 4,-1
3 field_gameplay_explain game_review 4,-1 4,-1
3 field_gameplay game_review 4,-1 4,-1
3 field_overall game_review 4,-1 4,-1
3 body game_review 4,-1 4,-1
3 title game_review 3,4,-1 4,-1
1 field_gameplay_explain game_review 4,-1 4,-1
1 field_gameplay game_review 4,-1 4,-1
1 field_overall game_review 4,-1 4,-1
1 body game_review 4,-1 4,-1
1 title game_review 4,-1 4,-1
4 field_audio_explain game_review 4,-1 4,-1
4 field_story_explain game_review 4,-1 4,-1
4 field_audio game_review 4,-1 4,-1
4 field_story game_review 4,-1 4,-1
4 field_comm_explain game_review 4,-1 4,-1
4 field_graphics_explaination game_review 4,-1 4,-1
4 field_community game_review 4,-1 4,-1
4 field_graphics game_review 4,-1 4,-1
4 field_gameplay_explain game_review 4,-1 4,-1
4 field_gameplay game_review 4,-1 4,-1
4 field_overall game_review 4,-1 4,-1
4 body game_review 4,-1 4,-1
4 title game_review 4,-1 4,-1
3 field_value game_review -1,4 -1,4
3 field_value_explain game_review -1,4 -1,4
3 field_replay game_review -1,4 -1,4
3 field_alt_opinion game_review -1,4,3 -1,4,3
3 field_replay_explain game_review -1,4 -1,4
5 field_replay_explain game_review 4,2,1,-1,3 4,-1
5 field_alt_opinion game_review 3,4,2,1,-1 3,4,2,-1
5 field_replay game_review 3,4,2,1,-1 4,-1
5 field_value_explain game_review 3,2,4,1,-1 4,-1
5 field_value game_review 3,4,2,-1,1 4,-1
5 field_audio_explain game_review 3,4,2,1,-1 4,-1
5 field_story_explain game_review 4,3,2,1,-1 4,-1
5 field_audio game_review 4,3,2,1,-1 4,-1
5 field_story game_review 3,4,2,1,-1 4,-1
5 field_comm_explain game_review 4,3,2,1,-1 4,-1
5 field_graphics_explaination game_review 3,4,2,1,-1 4,-1
5 field_community game_review 3,4,2,-1,1 4,-1
5 field_graphics game_review 3,1,2,4,-1 4,-1
5 field_gameplay_explain game_review 3,4,2,1,-1 4,-1
5 field_gameplay game_review 3,4,2,1,-1 4,-1
5 field_overall game_review 3,4,2,1,-1 4,-1
5 body game_review 3,4,2,1,-1 4,-1
4 field_value game_review -1,4 -1,4
4 field_value_explain game_review -1,4 -1,4
4 field_replay game_review -1,4 -1,4
4 field_alt_opinion game_review -1,4 -1,4
4 field_replay_explain game_review -1,4 -1,4
5 title game_review 4,2,1,-1 4,-1

infojunkie’s picture

Before we continue: please make sure to disable modules workflow_access and content_permissions for the time being. Does that fix anything?

The data dump is fine, thanks. So if I understand correctly, the field_alt_opinion should be editable by group 3 which are your editors.

Now the permission computation part happens in workflow_fields_compute_permissions(). In it, please insert the line var_dump($editables); just before the return statement. If the logged in user belongs to group 3, you should see ["field_alt_opinion"]=> bool(true). If it isn't, then you will need to examine the $groups array versus the $editable_roles array in the loop. When $row['name'] == 'field_alt_opinion', there should be common elements among those two arrays.

If all this is correct, then the code that hides/shows the fields is incorrect. We'll look at that later :-)

Thanks for your help!

demonix’s picture

Looks like it returns bool(true) in both arrays... In fact, everything returns true, not just field_alt_opinion. This is the dump:

array(0) { } array(0) { } array(18) { ["body"]=> bool(true) ["field_alt_opinion"]=> bool(true) ["field_audio"]=> bool(true) ["field_audio_explain"]=> bool(true) ["field_community"]=> bool(true) ["field_comm_explain"]=> bool(true) ["field_gameplay"]=> bool(true) ["field_gameplay_explain"]=> bool(true) ["field_graphics"]=> bool(true) ["field_graphics_explaination"]=> bool(true) ["field_overall"]=> bool(true) ["field_replay"]=> bool(true) ["field_replay_explain"]=> bool(true) ["field_story"]=> bool(true) ["field_story_explain"]=> bool(true) ["field_value"]=> bool(true) ["field_value_explain"]=> bool(true) ["title"]=> bool(true) } array(0) { } array(18) { ["body"]=> bool(true) ["field_alt_opinion"]=> bool(true) ["field_audio"]=> bool(true) ["field_audio_explain"]=> bool(true) ["field_community"]=> bool(true) ["field_comm_explain"]=> bool(true) ["field_gameplay"]=> bool(true) ["field_gameplay_explain"]=> bool(true) ["field_graphics"]=> bool(true) ["field_graphics_explaination"]=> bool(true) ["field_overall"]=> bool(true) ["field_replay"]=> bool(true) ["field_replay_explain"]=> bool(true) ["field_story"]=> bool(true) ["field_story_explain"]=> bool(true) ["field_value"]=> bool(true) ["field_value_explain"]=> bool(true) ["title"]=> bool(true) } array(0) { } array(0) { } array(0) { } array(18) { ["body"]=> bool(true) ["field_alt_opinion"]=> bool(true) ["field_audio"]=> bool(true) ["field_audio_explain"]=> bool(true) ["field_community"]=> bool(true) ["field_comm_explain"]=> bool(true) ["field_gameplay"]=> bool(true) ["field_gameplay_explain"]=> bool(true) ["field_graphics"]=> bool(true) ["field_graphics_explaination"]=> bool(true) ["field_overall"]=> bool(true) ["field_replay"]=> bool(true) ["field_replay_explain"]=> bool(true) ["field_story"]=> bool(true) ["field_story_explain"]=> bool(true) ["field_value"]=> bool(true) ["field_value_explain"]=> bool(true) ["title"]=> bool(true) } array(0) { }

infojunkie’s picture

You didn't answer concerning the workflow_access and content_permission modules. Also please make sure that cck_field_perms module is disabled (if you have it).

Concerning the permission arrays, they might be returning true because you as logged in user are also the author of this node or belong to group #4, and judging by the data dump you sent earlier the author and group #4 can view and edit all fields.

However, this does not explain why these fields don't show up on the form (for the same user). To make sure things work correctly without workflow_fields, insert a return; statement at the top of the function workflow_fields_node_form_alter(). When you try to edit the node, you should see all fields. If so, then remove that statement and make sure that the code execution reaches the // Standard handling section (using var_dump() for example). What do you get?

demonix’s picture

Huh... Thought I responded about those two. I turned them off last time, don't worry (and I don't have cck_field_perms either)

As for you latest suggestion, using return; at the beginning of the function showed everything, no problems. When I set up a var_dump() (inside the else statement) the var_dump() worked.

infojunkie’s picture

There aren't many obvious possibilities left :-) You can now check for the $visible variable inside that else statement, it should be true in your case. If it's false, check that the Drupal variable workflow_fields_hide_read_only_when_editing is set to false or doesn't exist. If $visible is true, then try var_dump(content_view_field($field, $node, FALSE, TRUE)) which is what's used to render the CCK field.

If all this fails, then I'll have to debug your live site, if you're willing ;-)

demonix’s picture

Hmm... Seems that workflow_fields_hide_read_only_when_editing was the problem. I had that enabled from the previous install... Is this not supported currently, in this version?

AHA... I see what I've been doing wrong. I assumed you needed to give users the permission to edit things. That was partially my mistake.

Thanks for all your help!

infojunkie’s picture

Status: Active » Fixed

Glad we found it! The variable workflow_fields_hide_read_only_when_editing is set to TRUE to instruct workflow_fields to override field settings and hide all read-only (non-editable) fields in the editing form. I guess that's not what you understood about its use right? Maybe the description text needs to be changed.

demonix’s picture

Well, now the CCK fields that are un-editable are hidden, and the main post is shown, however you can't edit it. I'm still trying to figure out why the variable hid the fields that were editable as well, but at least now it works.

infojunkie’s picture

This variable exists for that express purpose: to hide editable fields. Setting it to FALSE should make things work as expected.

BTW if you download the latest version, can you confirm that empty fieldgroups are hidden?

demonix’s picture

Downloaded, in my case, empty fieldgroups are NOT hidden.

infojunkie’s picture

Can you confirm that the version you have has line 326 that reads:

// Hide fieldgroups if necessary.

Thanks!

demonix’s picture

Yep, looks like it's there. Any other ideas?

infojunkie’s picture

Please insert the line

var_dump($field_name);

above line 332 (inside the nested if statement). That should tell us which field is causing the fieldgroup to appear.

Also, please make sure that the weight of workflow_fields module is greater than the weight of fieldgroup. You can adjust the weight attribute manually in the {system} table. Usually, fieldgroup has weight 9 so let workflow_fields have weight 10.

Thanks for your help!

demonix’s picture

Hmm... The dump didn't return anything, and the fieldsets no longer show up... Interesting...

infojunkie’s picture

So is it working for you now as it should?

demonix’s picture

So far, so good!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.