Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $first = true;
- foreach ( $packages as $package ) {
- if ( $first ) {
- $package = wc_paid_listings_get_package( $package );
- $package_id = $package->get_id();
- $cv_credit = $wpdb->get_row( "SELECT cv_credit, cv_credit_count, cv_credit_duration, date_purchased, credit_value FROM `wp_wcpl_user_packages` WHERE id = $package_id" );
- $amount_of_credits = $cv_credit->cv_credit; // AMOUNT OF CREDITS THE PACKAGE HAS
- $how_many_used = $cv_credit->cv_credit_count; // THE AMOUNT THEY HAVE USED
- $credit_value = $cv_credit->credit_value; // WHAT THEY HAVE SEEN (COMMA SEPARATED)
- $how_many_left = $amount_of_credits - $how_many_used;
- $credit_duration = $cv_credit->cv_credit_duration;
- $date_purchased = $cv_credit->date_purchased;
- $timestamp = strtotime($date_purchased);
- $date_purchased_yday = date("d", $timestamp); // day of the year
- $dayend = $date_purchased_yday + $credit_duration - 1; // when it ends
- $today = getdate();
- $today_yday = $today["yday"]; // todays day of the year
- $timeleft = $dayend - $today_yday;
- if ($timeleft >= "0") {
- if ($how_many_left >= "1") {
- $createarrayofvalues = explode(',', $credit_value);
- if (in_array($post->ID, $createarrayofvalues)) {
- ?>
- <div class="contact-information">
- <p>Mobile Number: <?php echo $mobile_number; ?> </p>
- <p>Email Address: <?php echo $email; ?> </p>
- <p>Links:
- <?php the_resume_links(); ?>
- </p>
- </div>
- <?php
- } // IF they have paid for the CV before
- else {
- ?> <a href="#" class="et_pb_button cv_credit">View contact information (<?php echo $how_many_left ?> credit/s left)</a> <?php
- }
- } // how many left
- else {
- echo "You have no more credits for this package";
- }
- }// time left on package
- else {
- }
- $first = false;
- } // if First
- else {
- }
- }
Add Comment
Please, Sign In to add comment