Created
December 11, 2009 09:10
-
-
Save investic/254101 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
/** | |
* Implementation of hook_nodeapi(). | |
* Drupal Crear dos nodos con un campo en comun | |
*/ | |
function sorteo_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) { | |
switch ($op) { | |
case 'insert': | |
//crear dos nodos de quiz relacionados por su campo de nid | |
if($node->type == 'quiz' && !$node->field_identificador[0]['value']){ | |
$nid=$node->nid; | |
$quiz = $node; | |
$quiz->field_identificador[]['value']=$nid; | |
unset($quiz->nid); | |
$quiz->language='eu'; | |
db_query("UPDATE {content_type_quiz} SET field_identificador_value = '%s' WHERE nid = %d",$nid,$nid ); | |
node_save($quiz); | |
drupal_goto('admin/sorteos'); | |
} | |
break; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment