Hi, first off, thanks for the great module!

What I would like to know is how I can include some of the CCK feilds that I have added to the resume to the emails that are generated. I have a need to be able to receive all the info in an email.

Can this be done and if so, can anyone teach me?

I am guessing I need to add it to the function job_send_email function, inside the job.module file, to somehow call the cck field of that users resume.

Any help on this would be greatly appreciated.

Regards,

CKD

CommentFileSizeAuthor
#10 361295.patch1.35 KBxamount
#10 361295_drupal6.patch1.14 KBxamount

Comments

kbahey’s picture

Status: Active » Closed (fixed)

In template.php add the following function:

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("\n\nManage job applications at @manage", array('@manage' => $base_url . url("job/applications")));

  return(array(
    'subject' => $subject,
    'body'    => $body,
    ));
}

This will then override the email that is sent. You need to add the field(s) you are interested in from $resume_node or $job_node.

Dokuro’s picture

So If I have a question asking if they can relocate, using a cck field. Would I do this?

$body .= t("\nCan you relocate:", array('@relocate' => $resume_node->field_can_you_relocate));

In the code below.

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,
    ));
}

Also, Thanks for the quick reply.

Regards,

CKD

Dokuro’s picture

Status: Closed (fixed) » Active

Just want to make this active

kbahey’s picture

Why ask when you can try it faster?

Go ahead and try it and see if it works. Report back either way and close if it does what you want.

Dokuro’s picture

Hi kbahey,

I really appreciate your time here. I have done two different ways, both don't work.

$body .= t("\nCan you relocate: @relocate",          array('@relocate' => $job_node->field_can_you_relocate));

And

$body .= t("\nCan you relocate: @relocate",                     array('@relocate' => $resume_node->field_can_you_relocate));

Any tips on what I am doing wrong here?

Regards,

CKD

kbahey’s picture

Add a line with print_r($resume_node);, and it will show you all the stuff that you can include in the email from the resume node. You can then select the relevant field(s).

Dokuro’s picture

Status: Active » Closed (fixed)

This works.

$body .= t("\nCan you relocate: @relocate", array('@relocate' => $resume_node->field_can_you_relocate[0][value]));

Need to get to the right level of the array, [0][value].

Thanks for the help!

CKD

kbahey’s picture

Status: Closed (fixed) » Active

Great to hear.

Now, your turn.

Can you write a paragraph or two summarizing this whole thing, so we can add it to the README.txt file and everyone can reference it going forward?

Dokuro’s picture

Yeah, no problem. I want to add some if's or ternary operators to it, so that it will check to see if you have that in the resume and if so, then it will send it in the email. I use two different apps on my site, and have different cck fields in there, but I will be more than happy to write it up.

Don't know if I will get to it until this weekend, but when I do I will post it back here.

Again, thanks,

CKD

xamount’s picture

Status: Active » Needs review
StatusFileSize
new1.14 KB
new1.35 KB

Here is a patch explaining how the theme functions can be overridden.

xamount’s picture

Issue summary: View changes
Status: Needs review » Fixed

I have updated the docs.

Status: Fixed » Closed (fixed)

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