Forums / Developer / How add another parent node to user object

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

How add another parent node to user object

Author Message

Matej Ukmar

Monday 12 April 2004 11:34:05 am

I am building web portal, where users have expiration time... I mean after 30 days their account expires.

I was thinking to assign or remove to user an extra user group which would tell if user is allowed to enter the portal. (This User goroup is linked to a portal user role)

The problem is I dont know how. I was trying with

	$newNode=eZContentObjectTreeNode::addChild( $user->attribute( 'contentobject_id' ), 12, true);

New node (of current user object) was created but it did not appear in the admin interface under the requested user group (id=12)

Maybe I just need to publish newly created node... I dont know how... I am a little confused, can anybody help.

And maybe there is also another more appropriate aproach to my user expiration problem.

Please help.

Thanx
Matey

Björn X

Monday 12 April 2004 9:57:06 pm

there is a little more to it

try this code

function & copyto (& $object,$node){
	$nodeAssignment =& eZNodeAssignment::create( array
		    	(
                  'contentobject_id' => $object->attribute( 'id' ),
                  'contentobject_version' => $object->attribute( 'current_version' ),
                  'parent_node' => $node,
                  'is_main' => 0
                 )
            );
    $nodeAssignment->store();
    #die("Here2".$node);
    $treenodegewerk = & eZContentObjectTreeNode::addChild($object->attribute( 'id' ),$node,true);
	$operationResult = eZOperationHandler::execute(
									'content', 'publish', array( 
									'object_id' => $object->attribute( 'id' ),
									'version' => $object->attribute( 'current_version' ) ) );
	 return eZContentObjectTreeNode::findNode($node,$object->attribute('id'),true); 
}

Matej Ukmar

Tuesday 13 April 2004 12:55:03 pm

Bjorn thanks,
this helps a lot... and it works!!! :-)

I have just one more little question.
If I want to remove a node is it enough just to use

eZContentObjectTreeNode::remove(...

or is there also some extra "coding" to be done?

Regards,
Matey

Dominik Pich

Thursday 22 April 2004 1:32:15 am

Remove its assignments first... ?