Monday 21 November 2005 7:45:56 am
I'm looking to add a user that exists in a existing user group (say, Guest accounts) to a newly created group, but I would like them to remain a member of the Guest accounts group. So far in the forums I have found reference to eZContentObjectTreeNodeOperations::move(), which moves an item to a new location without retaining the old one. Unfortunately, eZContentObjectTreeNodeOperations doesn't offer a similar method to add alocation. I have worked with some code which (I think) is executed when you add a location in the admin site [ kernel/content/action.php - around line 630 - $module->isCurrentAction( 'AddAssignment' ) ]. I've picked out what seems to be the appropriate code...
$userVersion =& user->createNewVersion(false, true);
$nodeAssignment =& $userVersion->assignToNode($myGroup->attribute('main_node_id'), false);
eZOperationHandler::execute('content', 'publish', array('object_id', => $user->attribute('id'), 'version' => $userVersion->attribute('version')));
...but I can't seem to get the final result I'm looking for. Any thoughts? Thanks, Brian.
|