I need to pull the nid immediately after it is created using entity_metadata_wrapper as a creation method.
Here is a brief example:
$values = array(
'type' => 'content_type',
'uid' => $user->uid,
'status' => 1,
'comment' => 1,
'promote' => 0,
);
$entity = entity_create('node', $values);
$wrapper = entity_metadata_wrapper('node', $entity);
$wrapper->title->set('title');
$wrapper->save(true);
entity_save('node', $entity);
// From this, where can I get a NID value for the node that was just created?
dpm($wrapper);
. Otherwise try the following code: echo '<PRE>'; print_r($wrapper); echo '</PRE>';$wrapper->save()
andentity_save()
- just one will suffice, else you're saving the node twice. Also, nid will be added to the wrapper after save, e.g$wrapper->nid->value();