Last active
December 18, 2015 03:39
-
-
Save alechko/5720062 to your computer and use it in GitHub Desktop.
Create node in drupal
This file contains 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
<?php | |
// Create a node object, and add node properties. | |
$newNode = new stdClass(); | |
$newNode->type = 'node_example'; | |
$newNode->uid = 0; | |
$newNode->created = strtotime("now"); | |
$newNode->changed = strtotime("now"); | |
$newNode->status = 1; | |
$newNode->comment = 0; | |
$newNode->promote = 0; | |
$newNode->moderate = 0; | |
$newNode->sticky = 0; | |
$newNode->language = 'und'; | |
$newNode->field_email['und'][0]['value'] = $form_state['values']['email']; | |
// Save the node. | |
node_save($newNode); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment