[development] clone a node

Lluís enboig at gmail.com
Mon Jul 21 11:44:51 UTC 2008


I have developed a simple group system (similar to OG in some ways,
very diferent in others) so I need a user beeing able to import nodes
from other groups to his own.
To do so I have created a form which loads all the nodes from other
groups as checkboxes. The checked items will be cloned to his group.

I haven't tried node_clone, but I think it is UI oriented; I just need
to clone a node knowing its ID (all group permissions, etc... are
rewritten using nodeapi of my custom node).


On Mon, Jul 21, 2008 at 11:59 AM, Nathaniel Catchpole
<catch56 at googlemail.com> wrote:
> You could take a look at the node_clone module if you haven't already:
> http://drupal.org/project/node_clone
>
> On Mon, Jul 21, 2008 at 10:55 AM, Lluís <enboig at gmail.com> wrote:
>> I have developed a custom module with custom node types and I need to
>> make users able to clone nodes; would this be a good way to do so?
>>
>>      $clone=node_load($value);
>>      $clone->is_new = true;
>>      $clone->uid = $user->uid;
>>      unset($clone->nid);
>>      unset($clone->vid);
>>      node_save($clone);
>>
>>
>> --
>



-- 
*La vida és com una moneda, la pots gastar en el que vulguis però
només una vegada.
*La felicitat ha de ser compatible, compartible i cooperativa.
*Envellim quan els records superen les il·lusions.
*Als llocs desconeguts només s'hi arriba per camins desconeguts.
*Abans d'imprimir aquest missatge, pensa en el medi ambient.


More information about the development mailing list