I have inherited a custom module, which groups together some field of an custom ContentType and sends it by email.

In the module there are 3 functions.

Email check preg match:

function __autoload($class_name) {
  require_once($class_name . '.lib.php');

This function gets triggered when the node is saved or updated. Right?

function vumveranstaltungsmailer_action_info() {
  return array(
    'vumveranstaltungsmailer_action' => array(
      'type' => 'node',
      'label' => 'vumveranstaltungsmailer_action',
      'configurable' => FALSE,
      'triggers' => array('node_insert', 'node_update'),

Do stuff, send email:

function vumveranstaltungsmailer_action($object, $context) {
//do Stuff, sends email. Not shown here.

//I want to set this field to empty/clear it


Bare with me, I am pretty a beginner/noob. I am a bit overwhelmed where and how to do it. Please give me a simple solution, so I understand it. Quick and dirty is fine for me ;-)

  • so you want to change the field value after sending the email ? – harshal Nov 13 '13 at 16:48
  • Yes, because I need the field value as the recipient. – whitefleaCH Nov 13 '13 at 16:51
  • ok I will answer pls check the answer – harshal Nov 13 '13 at 16:52
  • are all the fields from the same node or from different can u elaborate on that part? – harshal Nov 13 '13 at 16:52
  • Yes, all the fields are from the same node/CT. ` function vumveranstaltungsmailer_action($object, $context) { dsm($object, '$object'); if ($object->type === 'veranstaltung' && $object->status === 1 && isset($object->field_email_mailer_01['und']['0']['value'])) { //do Stuff, sends email. Not shown here. //I want to set this field to empty/clear it $object->field_email_mailer_01['und']['0']['value']->set(NULL); } } ` – whitefleaCH Nov 13 '13 at 16:58

Once you get your nid of the node you can use the code below to change the field value

  $node = node_load($nid);

    //similarly for other fields you can change the value

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.