Commit 7ad5f4fd by nadeem.qasmi

All fixes Done

parent d360d752
Pipeline #433 passed with stage
in 0 seconds
<?php
function set_html_content_type(){
return 'text/html';
}
if ( 'POST' === $_SERVER['REQUEST_METHOD'] && isset( $_POST['download_submit'] ) && $_POST['post_action'] === 'download-all' ) {
$fname = $_POST['dl_firstName'];
$lname = $_POST['dl_lastName'];
......@@ -18,12 +22,24 @@ if ( 'POST' === $_SERVER['REQUEST_METHOD'] && isset( $_POST['download_submit'] )
$postContent .= '<strong>Job Title: ' . $jobTitle . '</strong><br>';
$postContent .= '<strong>Country: ' . $country . '</strong><br>';
$courseName = array();
foreach ( $dlCourses as $course ) {
$courses = new WP_Query( array( 'post_type' => 'vq_course' ) );
while ( $courses->have_posts() ) {
$courses->the_post();
if ( $course == get_the_ID() ) {
$courseName[] = get_the_title();
foreach ( $dlCourses as $catx ) {
$course_cat = get_terms( array(
'taxonomy' => 'vq_course_taxonomy',
'parent' => 0,
'hide_empty' => false,
));
foreach ($course_cat as $cat){
$id_cat = $cat->term_id;
if ( $catx == $id_cat ) {
$courseName[] = $cat->name;
}
}
}
......@@ -35,6 +51,15 @@ if ( 'POST' === $_SERVER['REQUEST_METHOD'] && isset( $_POST['download_submit'] )
'post_content' => $postContent
);
$to = $_POST['dl_email'];
$subject = "Download Confirmation";
$body = '';
$body .= $postContent;
add_filter('wp_mail_content_type', 'set_html_content_type');
wp_mail($to, $subject, $body);
remove_filter('wp_mail_content_type', 'set_html_content_type');
$pid = wp_insert_post( $newDownloadRequest );
update_post_meta( $pid, 'dl_firstName', $fname );
......@@ -54,7 +79,13 @@ get_header();
$page = get_page_by_path( 'download-all' );
$settings = $options = get_option( 'vq_lms_settings_options' );
$video = $settings['vq_lms_settings_field_video'];
$courses = new WP_Query( array( 'post_type' => 'vq_course' ) );
//$courses = new WP_Query( array( 'post_type' => 'vq_course' ) );
$course_cats = get_terms( array(
'taxonomy' => 'vq_course_taxonomy',
'parent' => 0,
'hide_empty' => false,
));
$selected_id = isset( $_GET['course'] ) ? $_GET['course'] : - 1;
?>
......@@ -360,16 +391,23 @@ $selected_id = isset( $_GET['course'] ) ? $_GET['course'] : - 1;
</div>
<div class="col-md-12 form-group">
<select class="form-control chosen-select" name="dl_course[]" multiple
data-placeholder="Select Courses" id="dl_crs" required >
data-placeholder="Select Course Categories" id="dl_crs" required >
<?php
while ( $courses->have_posts() ) {
$courses->the_post();
foreach ($course_cats as $term) {
$meta = '';
$idx = $term->term_id;
$meta = get_term_meta($idx, 'vq_course_ct_tax_redirect', true);
if(!empty($meta)){
?>
<option value="<?php the_ID(); ?>" <?php if ( get_the_ID() == $selected_id ) {
<option value="<?php echo $term->term_id; ?>" <?php if ( $term->term_id == $selected_id ) {
echo ' selected';
} ?>><?php the_title(); ?></option>
} ?>><?php echo $term->name; ?></option>
<?php
}
} }
$page = get_page_by_path( 'download-all' );
?>
</select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment