Forums / Developer / Moving an object through php?

Moving an object through php?

Author Message

Clemens T

Monday 10 October 2005 8:35:25 am

Heya all,
I have a user object @ position 1, now I want to move the user to another group @ position 2, I know both node_id's.. how can I make the move?
(in my own module, and in php)
Thanks,
Clemens

Bruce Morrison

Monday 10 October 2005 4:26:36 pm

Hi Clemens

Code to accomplish this can be found in kernel/content/action.php around line 199
else if ( $module->isCurrentAction( 'MoveNode' ) )

http://pubsvn.ez.no/websvn/filedetails.php?repname=nextgen&path=%2Ftrunk%2Fkernel%2Fcontent%2Faction.php&rev=13600&sc=1

In the trunk the key line appears to be:

eZContentObjectTreeNodeOperations::move( $nodeID, $selectedNodeID )

Where $nodeID is the node you want to move and $selectedNodeID is the destination.

Much of the preceeding code is checking that the permissions are in place.

The code in 3.6.1 seems to be a bit different in that much of the moving work is actually done in action.php

HTH

Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Clemens T

Wednesday 26 October 2005 2:51:19 pm

Excellent job. Thanks a lot! Worked like a charm :).