Created
January 31, 2023 22:33
-
-
Save BruceMcKinnon/1be028b31db86756ca564d579cb2da02 to your computer and use it in GitHub Desktop.
SJB Attach resumes to Admin & HR emails
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get the uploaded resume and return it's path to the email handler | |
function ingeni_sjb_get_attachment( $resume_path, $post_id ) { | |
// Get the resume_path assigned to that postID | |
// https://www.presstigers.com/how-can-simple-job-board-settings-help-you/ | |
global $wpdb; | |
$resume_path = ''; | |
$fileAttachment = get_post_meta($post_id, 'resume', TRUE); | |
$path_start = stripos( $fileAttachment, '/uploads/' ); | |
if ($path_start) { | |
$fileAttachment = substr( $fileAttachment, $path_start, strlen($fileAttachment) - $path_start ); | |
} | |
$attachments = array( WP_CONTENT_DIR . $fileAttachment ); | |
return $attachments; | |
} | |
add_filter( 'sjb_admin_notification_attachment', 'ingeni_sjb_get_attachment', 20, 2 ); | |
add_filter( 'sjb_hr_notification_attachment', 'ingeni_sjb_get_attachment', 20, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment