including CCK fields in notification emails
mdowsett - May 21, 2008 - 17:44
| Project: | Notify |
| Version: | 5.x-1.x-dev |
| Component: | User interface |
| Category: | feature request |
| Priority: | minor |
| Assigned: | matt2000 |
| Status: | active |
Jump to:
Description
how can you include CCK fields in the notifications that go out?
Currently the notifications only include:
Title
Author
Link to node
Body text
And the /node page does show the CCK fields added to content in the node listing...and those fields are shown in the body as well. It shouldn't have to be defined in the notify.module as every node type would have different/custom CCK fields...

#1
Id like to see an answer to this question so that notify and cck can become a serious web form to e-mail solution.
#2
Webform module is a pretty serious web form to email solution...
But it shouldn't be too hard to have notify include whatever output would normally be included when displaying the node. I'll keep it under consideration.
You may also want to look into subscriptions module if you want something more flexible.
#3
Thanks for the fast reply,
If I have a cck field called field_can_you_relocate, asking them if they can relocate?
Would I do it as I have below?
<?php
function phptemplate_job_mail($job_node, $job_user, $resume_node, $resume_user) {
global $base_url;
$site = variable_get('site_name', 'drupal site');
$subject = t("[$site] [Job application] for [$job_node->title] by [$resume_user->name]");
$body = t("The following user has applied for the above job.\n");
$body .= t("\nJob: @title", array('@title' => $job_node->title));
$body .= t("\nJob URL: @url", array('@url' => $base_url . url("node/$job_node->nid")));
$body .= t("\nApplicant name: @name", array('@name' => $resume_user->name));
$body .= t("\nApplicant email: @email", array('@email' => $resume_user->mail));
$body .= t("\nApplicant URL: @url", array('@url' => $base_url . url("user/$resume_user->uid")));
$body .= t("\nResume: @title", array('@title' => $resume_node->title));
$body .= t("\nResume URL: @url", array('@url' => $base_url . url("node/$resume_node->nid")));
$body .= t("\nCan you relocate:", array('@relocate' => $resume_node->field_can_you_relocate));
$body .= t("\n\nManage job applications at @manage", array('@manage' => $base_url . url("job/applications")));
return(array(
'subject' => $subject,
'body' => $body,
));
}
?>
Again thanks,
CKD