lundi 3 décembre 2018

Php function call is not returning data

I have this part of the code which is used to download the resume in pdf format in front-end.

<?php
    if( ! defined( 'ABSPATH' ) ) {
        exit;
    }
    $applicant_email = esc_attr( get_post_meta( $post->ID, 'awsm_applicant_email', true ) );
?>

<div class="awsm-application-container clearfix">
    <div class="awsm-applicant-image-container">
        <?php
            $avatar = apply_filters( 'awsm_applicant_photo', get_avatar( $applicant_email, 130 ) );
            echo '<div class="awsm-applicant-image">' . $avatar . '</div>';
            $attachment_id = get_post_meta( $post->ID, 'awsm_attachment_id', true );
            $resume_details = $this->get_attached_file_details( $attachment_id );
            if( ! empty( $resume_details ) ) :
                $file_size_display = ! empty( $resume_details['file_size']['display'] ) ? '(' . $resume_details['file_size']['display'] . ')' : '';
        ?>
                <a href="<?php echo $this->get_attached_file_download_url( $attachment_id ); ?>" class="button awsm-applicant-resume-btn" rel="nofollow"><strong><?php esc_html_e( 'Download Resume', 'wp-job-openings' ); ?></strong><span><?php echo esc_html( $resume_details['file_type']['ext'] ) . $file_size_display; ?></span></a>
        <?php endif;  ?>
    </div><!-- .awsm-applicant-image-container -->

    <div class="awsm-applicant-details">
        <ul class="awsm-applicant-details-list">
            <?php echo $this->get_applicant_meta_details_list( $post->ID, array( 'awsm_applicant_email' => $applicant_email ) ); ?>
        </ul>
    </div><!-- .awsm-applicant-details -->
</div><!-- .awsm-application-container -->

<div class="submitbox awsm-application-submitbox">
    <div id="major-publishing-actions" class="awsm-application-major-actions clearfix">
        <div id="delete-action">
            <?php
                if ( current_user_can( "delete_post", $post->ID ) ) {
                    if ( !EMPTY_TRASH_DAYS )
                        $delete_text = __('Delete Permanently');
                    else
                        $delete_text = __('Move to Trash');
            ?>
                    <a class="submitdelete deletion" href="<?php echo get_delete_post_link( $post->ID ); ?>"><?php echo $delete_text; ?></a><?php
                } ?>
        </div>
    </div><!-- #major-publishing-actions -->
</div><!-- .awsm-application-submitbox -->

I am trying to create a column in a table with name resume in which I want to provide the download URL or link from where the user can download the resume of each applicant on click but when I am trying to do this it is returning nothing.

 public function awsm_job_application_manage_custom_data($columns, $post_id) {
        global $submission;
        $job_id = get_post_meta( $post_id, 'awsm_job_id', true );
        $job_name = get_post_meta( $post_id, 'awsm_apply_for', true );

        switch ($columns) {
                case 'awsm-photo' :
                $applicant_email = esc_attr( get_post_meta( $post_id, 'awsm_applicant_email', true ) );
                $avatar = apply_filters( 'awsm_applicant_photo', get_avatar( $applicant_email, 32 ) );
                echo $avatar;
                break;
            case 'application_id' :
                edit_post_link( __( $post_id ) );
            break;

            case 'applied_for' :
                printf( '<a href="%2$s" title="%3$s">%1$s</a>', $job_name, esc_url( get_edit_post_link( $job_id ) ), esc_html__( 'View Job: ', 'wp-job-openings' ) . $job_name );
            break;

            case 'submisssion_time' :
                $submission = human_time_diff( get_the_time( 'U' ), current_time('timestamp') ) . ' ago';
                echo $submission;
            break;
            
            case 'resume' :
            $applicant_email = esc_attr( get_post_meta( $post_id, 'awsm_applicant_email', true ) );
            $avatar = apply_filters( 'awsm_applicant_photo', get_avatar( $applicant_email, 130 ) );
            $attachment_id = get_post_meta( get_the_ID(), 'awsm_attachment_id', true );
            $resume_details = $this->get_attached_file_details( $attachment_id );

            printf($this->get_attached_file_download_url( $attachment_id ));
            
        }
    }

Format of table This is the format of the table where I am getting all the data which I want but only resume URL is not coming on calling the function.

Anyone has an idea where I am doing wrong.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2REy0Bu
via IFTTT

Aucun commentaire:

Enregistrer un commentaire