Active
Project:
CCK Private Fields
Version:
6.x-1.1
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
28 Mar 2010 at 01:27 UTC
Updated:
13 May 2010 at 19:37 UTC
I first like to say that I have been trying to use the cck_field privacy module but found it buggy and lacking the features needed. After only installing your module today I am already far more impressed with it.
One useful feature cck_field_privacy was trying to work towards was the ability to make fields private to particular friend types. The general concensus was that the best way to achieve this would be to have 3 radio button (everyone, noone and friends), if 'friends' was selected it would provide checkboxes for the different friend types.
Do you think this is something this module will provide in the future?
regards, Adam
Comments
Comment #1
adam_c commentedI have a plan of how I will make a patch to give the above functionality.
1. Add available relationship types to the dialog box as a set of checkboxes:
foreach (user_relationships_types_load() as $rtid => $relationship) {
$relationship_types[$rtid] = $relationship->plural_name;
}
$form['cck-private-fields-dialog-status-options-friends'] = array(
'#type' => 'checkboxes',
'#title' => t('Choose a friend type'),
'#options' => $relationship_types,
'#description' => t('Use these options to select which friend type can view this.'),
'#weight' => 1,
);
2. Add a column to the field table which will contain the serialised results of the checkboxes. I can do that
3. in modules/cck_private_fields_user_relationships/cck_private_fields_user_relationships.module replace:
$relationship_types = variable_get('cck_private_fields_user_relationships_types_'. $field['field_name'], array());
with a query that returns the contents of the new field specific serialised results.
And that should be very nearly it (along with some other minor tweaks).
My problem is that because the form submit for the dialog box is done in the javascript file, I cant figure out how I would add the array of checkbox values to the form like the radio buttons below:
$('input[name="cck-private-fields-dialog-status-options"][value='+ privacyStatus +']', $dialogContainer).attr('checked', 'checked');
Which leads to the next question, if the array was added to the form, as this module does not implement _form_submit to further process the form, would that array be automatically serialised by drupal?
Any help would be greatly appreciated!