Problem
I'm building a module to let users apply to a job. The user goes to a job advert, presses apply and it sends their CV to the author of the job advert.
I have it working, but I'm worried that the way I grab the users email is inefficient and I was wondering if there was a better way to do it.
Current Set-up
I have a custom form with a submit function. I grab the email of the author of the current node using the following:
function jobapplication_form_submit($form, &$form_state) {
if(arg(0) == 'node' && is_numeric(arg(1))){
$node = node_load(arg(1));
$user = user_load_multiple(array(),array('uid' => $node->uid));
};
$email = $user['1']->mail;
Is there a way to get the node author email without having to load the entire node? It seems really inefficient (at least to my inexperienced eyes).