Hallo,
For my project, I have the following setup:
- a content type party (and coherent access as enabled, default is not private)
- a cck userreference party host.

I build a batch import form with some values that automatically create the title. In my submit function a use emtpy $node object to store all the needed values like $node->title, etc. and then save it with node_save($node);
WORKS
But how do I set the coherent_access viewers? I tried:

$node->coherent_access['private'] = 1;
$node->coherent_access['viewers'][23] = "userx";

But the values are not saved after node_save.

Any hints?

Comments

Ghostthinker’s picture

Version: 5.x-1.1 » 6.x-1.x-dev
jgraham’s picture

It should work if you set the following to a serialized array of usernames keyed by uid.

$node->shared_editing['edit']['editor_list']
$node->shared_editing['view']['viewer_list']

So to use your example:

$viewers = array(23 => 'userx');
$node->shared_editing['view']['viewer_list'] = serialize($viewers);

janusman’s picture

Status: Active » Closed (fixed)

Marking this as fixed.