How to add a notification for the system admin to get a notification when an applicant applies for a job using smartjobboard software.
What I wanted was to be able to get a notification when an applicant applies to a job. As an admin you must know what is going on with the site. Any site for that matter, but especialy with job boards. It is critical so you can know how to modify SEO campaigns and a whole host of other things. Here is the specs I want when the job is done:
1) Email should have the job seekers info on it.
2) Email should have the employer info on it.
3) Email should have the job info on it.
To get started we first need to identify where in the source code we need to add the functionality. The first file we will need is /system/user-scripts/classifieds/apply_now.php. Inside that file search for "Notifications::sendApplyNow", it should be around line 92.. It will look like this before we start modifications:
———————————————————————-
if ( !Notifications::sendApplyNow($post,"files/files/".$file_name,$listing_info, $current_user_sid, $notRegisterUserData) )
$errors['SEND_ERROR'] = true;
———————————————————————-
PS: programmers out there, you should always bracket your if statements… It bugs the hell out me when ppl dont bracket there if statements!!!
Replace the lines above with the code below:
———————————————————————-
if ( !Notifications::sendApplyNow($post,"files/files/".$file_name,$listing_info, $current_user_sid, $notRegisterUserData) )
{
$errors['SEND_ERROR'] = true;
}
else
{
//send admin notification with info about who applied and to what job for what company
//////////////////////////////////////////////////////////////////////////////////////
AdminNotifications::sendAdminApplyNow($post,"files/files/".$file_name,$listing_info, $current_user_sid, $notRegisterUserData);
}
———————————————————————-
Next open /system/lib/miscelanious/AdminNotifications.php and add this line at the top of the page:
require_once("users/User/UserManager.php");
Then add this function in the class with the other functions. I added it at the bottom of the file… (inside the brackets like the rest of the functions)
———————————————————————-
function sendAdminApplyNow($info, $file = '', $data_resume = array(), $current_user_sid = false, $notRegisterUserData = false, $companyData = array()) {
//get the job seekers email address
if($current_user_sid) {
$user_info = UserManager::getUserInfoBySID($current_user_sid);
$sender_email_address = $user_info['email'];
} else {
$sender_email_address = $notRegisterUserData['email'];
}
//get the admin email address
$admin_email = Settings::getSettingByName('notification_email');
//get the company info
$info['listing']['empEmail'] = $info['listing']['user']['email'];
$info['listing']['empName'] = $info['listing']['user']['CompanyName'];
//get the template for the email
$email = new Email( $admin_email, '../email_templates/admin_apply_now.tpl',
array('listing' => $info['listing'], 'seller_request'=>$info['submitted_data'], 'data_resume' => $data_resume) );
$email->setReplyTo($admin_email);
if ($file != '')
$email->setFile($file);
//send it out
return $email->send();
}
———————————————————————-
Finaly the last step besides testing…
We need to create a template for the email to be sent with so we need to add a new template for it. Create a file in /templates/_system/email_templates/ named admin_apply_now.tpl.
All together the file and path should be like this:
/templates/_system/email_templates/admin_apply_now.tpl
Open your new empty file and paste the following code into it:
———————————————————————-
{subject}New Applicant for {$listing.empName}{/subject}
{message}
An application to job posting '{$listing.Title}' was just submitted:<br />
<hr>
Employer Information<br />
Employer Name: {$listing.empName}<br />
Employer Email: {$listing.empEmail}<br />
Employer Link:<br />
<a href="http://www.yourdomain.com/search_results_jobs/?action=search&username[equal]={$listing.empEmail}">http://www.yourdomain.com/search_results_jobs/?action=search&username[equal]={$listing.empEmail}</a>
<hr>
Job Information<br />
Job ID: {$listing.id}<br />
Job Link:<br />
<a href="http://www.yourdomain.com/display_job/{$listing.id}/">http://www.yourdomain.com/display_job/{$listing.id}/</a>
<hr>
Job Seeker Information<br />
Name: {$seller_request.name}<br />
Username: {$seller_request.username}<br />
Email: {$seller_request.email}<br />
Cover Letter (optional): {$seller_request.comments}<br/>
User resume: <a href="{$GLOBALS.site_url}/display_resume/{$data_resume.sid}">{$data_resume.Title}</a><br/>
<br />
{/message}
———————————————————————-
In the code above you must replace yourdomain.com with whatever your domain is. Save your file now.
AND….. ….. …. WA BAM! Your done. There you have it a customized admin notification for when applicants apply for a job.
Let me know if this helps anybody out there! I would love to hear from you.
Joe Mas

