Hi!, I'm trying to integrate redhen with contact_entityform, but I don't understand how to create a redhen contact programmatically, I've achieved to create a contact, but just with the first_name working, the email field I don't know how to pass the data from entityform to contact.

I've used that

$redhen_contact = entity_create('redhen_contact', array('type' => 'contacto'));
$redhen_contact->first_name = $name;
$redhen_contact->redhen_contact_email = $mail;
entity_save('redhen_contact', $redhen_contact);

I've seen the webform_redhen module but I don't understand or I missed somethings, somebody there could show me with an example how to create a contact programmatically, with entity_api or another way, thanks!!!...

Comments

levelos’s picture

Status: Active » Fixed

You can use the following:

$redhen_contact = redhen_contact_create(array('type' => 'contact'));
$redhen_contact->setEmail('me@example.com');
$redhen_contact->save();

What's contact_entityform?

roberto_araya’s picture

Thanks!!!... about contact_entityform it's a module that works with entityform. I have another question relate with create contact, how I can set fields created with Field API?

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.