Support » Plugin: Simple Job Board » Send the uploaded CV to HR

Viewing 10 replies - 16 through 25 (of 25 total)
  • Plugin Author PressTigers

    (@presstigers)

    Hi argilmour,

    We have a look on above provided code snippet. It seems like that “$post_id” is not working in your case.

    Please debug your code and make sure that it is getting post id.

    Thanks & Regards,
    PressTigers

    There is a bug in the plugin. It is fetching the url of the attachment while wp_mail() function requires the file path (not url) to use as attachment in email. This worked for me:

    /**
     * Job Board stuffs
     *
     * */ 
    
    // Filter to Attach HR Resume
    add_filter('sjb_hr_notification_attachment', 'custom_code_for_hr_resume_attachment', 20, 2);
    add_filter('sjb_admin_notification_attachment', 'custom_code_for_hr_resume_attachment', 20, 2);
    
    function custom_code_for_hr_resume_attachment( $resume_path, $post_id ){
    
        $fileAttachment = get_post_meta($post_id, 'resume', TRUE);
        $filePath = parse_url($fileAttachment, PHP_URL_PATH);
        return array(get_home_path() . $filePath);
    }

    Plugin Author PressTigers

    (@presstigers)

    Dear icyice,

    First of all, we would like to say thanks to share your code with SJB users. But we would also like to tell you that your mentioned error in SJB plugin is not actually error.

    Basically this “Resume attachment in email notification” is not a default functionality in our plugin. So because of that you should not say that it’s error in plugin.

    As you can read in above threads, we were given guidelines (not making correction in plugin’s code) to our users that how you can add/extend this functionality in SJB plugin.

    We hope you got our point and good luck to extend SJB plugin.

    Thanks & Regards,
    PressTigers

    its grate its worked for me 🙂

    Plugin Author PressTigers

    (@presstigers)

    @raguragesh good to hear that it helped you 🙂

    Hi,

    I have used the code below which is provided by @icyice to receive attachment along with the emails, but it’s not working. I have put the code inside my theme fucntions.php file. Could you help me with this please. Thank you.

    /**
     * Job Board stuffs
     *
     * */ 
    
    // Filter to Attach HR Resume
    add_filter('sjb_hr_notification_attachment', 'custom_code_for_hr_resume_attachment', 20, 2);
    add_filter('sjb_admin_notification_attachment', 'custom_code_for_hr_resume_attachment', 20, 2);
    
    function custom_code_for_hr_resume_attachment( $resume_path, $post_id ){
    
        $fileAttachment = get_post_meta($post_id, 'resume', TRUE);
        $filePath = parse_url($fileAttachment, PHP_URL_PATH);
        return array(get_home_path() . $filePath);
    }

    Kind Regards,

    Bikash

    I tried below code but it was not working at all.
    // Filter to Attach HR Resume
    add_filter(‘sjb_hr_notification_attachment’, ‘custom_code_for_hr_resume_attachment’, 20, 2);

    function custom_code_for_hr_resume_attachment( $resume_path, $post_id ){

    // Write custom code here.
    return get_post_meta($post_id, ‘resume’, TRUE);

    }

    So Now I manage to upload file using below code and it is working absolutely perfect.

    if you want to send email to HR email address please open class-simple-job-board-notification.php. This file you will find under simple-job-board/includes/class-simple-job-board-notification.php.

    public static function hr_notification($post_id) {

    // Applied job title
    $job_title = get_the_title($post_id);
    $to = apply_filters( ‘sjb_hr_notification_to’, get_option(‘settings_hr_email’) );
    $subject = apply_filters( ‘sjb_hr_notification_sbj’ , ‘Applicant Resume Received[‘ . $job_title . ‘]’, $job_title );
    $message = self::job_notification_templates($post_id, ‘HR’);
    $headers = array(‘Content-Type: text/html; charset=UTF-8’);
    $attachments_url = get_post_meta($post_id, ‘resume’, TRUE);
    $attachment_explode = explode(“wp-content”, $attachments_url);
    $attachments = array( WP_CONTENT_DIR .$attachment_explode[1]);
    //$attachment = apply_filters( ‘sjb_hr_notification_attachment’, ”, $post_id );
    if (” != $to)
    wp_mail( $to, $subject, $message, $headers, $attachments );
    }

    Modify hr_notification function and following code:

    $attachments_url = get_post_meta($post_id, ‘resume’, TRUE);
    $attachment_explode = explode(“wp-content”, $attachments_url);
    $attachments = array( WP_CONTENT_DIR .$attachment_explode[1]);

    Thank you. Happy coding.

    Thanks a lot @hhetpanchal. I have tried doing your way and now it works perfectly. Thanks again.

    hi @bikash01 ,

    can you please tell me how you acheived this , i tried it but its not working .
    Thank you 🙂

    got it Thanks 🙂

Viewing 10 replies - 16 through 25 (of 25 total)
  • The topic ‘Send the uploaded CV to HR’ is closed to new replies.