I am trying to create in Drupal a cck computed field that copies an email address from a cck field in a "job post" node content type to this computed field in the "job application" node content type. I have found the following code that works perfectly, when I paste it into the "Computed Code:" box in the cck computed field
// obtain node id from nodereference cck field that links
// the job application node to the job post node
$item_nid = $node->field_appl_position[0]['nid'];
//load and build the information from the referenced job post node
$item_node = node_load($item_nid);
$item_node = node_build_content($item_node);
//get the email address from the cck email field in the referenced job post node
$item_email = $item_node->field_job_email[0]['email'];
//copy the email address to the computed field in the job application node
$node_field[0]['value'] = $item_email;
However, when I try to send an email using the content of the computed field nothing happens. I believe this is the case because the computed field is not formatted as a mailto link. I have tried to change the parameters in the "Display Format:" box in the computed field, but have not succeeded. Can anybody please help? Thanks!
you can use the following Drupal API function to format your link:
http://api.drupal.org/api/drupal/includes--common.inc/function/l/6
so in this case the value for your computed field would be the following:
l('Mail me', 'mailto:'.$item_email);