I have a problem and I was able to fix it by hacking the Draft module code. This is of course a Bad Thing (TM) so I thought I would reach out to see if anyone had a better solution.

Using:
Drupal 6.20, CCK 2.8, Draft 1.x-dev and Automatic Node Titles 1.2

I have a content type which only certain user roles are allowed to edit the title on. To achieve this, I am using the Automatic Node Titles module to hide the title field on the add/edit form and on save populate it with the value in a CCK field 'Name' which has its edit permissions restricted to the right roles. I have also disabled the body for this input type and replaced it with a series of more focused CCK fields ('Summary', 'Testing Plan', etc. ). That part works great.

In the Drafts configuration for the content type I have set the options to use the Name field as the value for the title and the body to the Summary field. However whenever I save a draft the title and body values in the database are both NULL. After poking around to see if it was a settings thing I started looking at the code.

I found that CCK is creating the field with the form name: 'field_name(0)(value)' which is the index for the field in $_POST while Draft is looking for 'field_name' in $_POST. If I edit draft.page.inc line 163 from:

$title_field = variable_get('save_as_draft_title_'. $type, 'title');

to

$title_field = variable_get('save_as_draft_title_'. $type, 'title').'(0)(value)';

the title field gets populated properly. This is obviously far from an optimal solution. Has anyone else encountered something like this? What is the best way to fix this? Is this just something funky with my setup or what?

Any insights would be appreciated.

Thanks.
Andrew

Comments

lane.angelique’s picture

I recently had the same issue when I tried to use a custom CCK field in the mapping. The value was always NULL.