get_col("SELECT `id` FROM `".WPSC_TABLE_PURCHASE_LOGS."` WHERE user_ID = ".(int)$user_ID."") ; $rowcount = count($purchases); //echo "
".print_r($purchases,true).""; if($rowcount >= 1) { $perchidstr = "("; $perchidstr .= implode(',',$purchases); $perchidstr .= ")"; $sql = "SELECT * FROM `".WPSC_TABLE_DOWNLOAD_STATUS."` WHERE `purchid` IN ".$perchidstr." AND `active` IN ('1') ORDER BY `datetime` DESC"; $products = $wpdb->get_results($sql,ARRAY_A) ; } //exit($products); foreach ((array)$products as $key => $product){ $sql = "SELECT `processed` FROM `".WPSC_TABLE_PURCHASE_LOGS."` WHERE `id`=".$product['purchid']; $isOrderAccepted = $wpdb->get_var($sql); if($isOrderAccepted > 1){ if($product['uniqueid'] == null) { // if the uniqueid is not equal to null, its "valid", regardless of what it is $links[] = get_option('siteurl')."?downloadid=".$product['id']; } else { $links[] = get_option('siteurl')."?downloadid=".$product['uniqueid']; } $sql = "SELECT * FROM `".WPSC_TABLE_PRODUCT_FILES."` WHERE id = ".(int)$product['fileid'].""; $file = $wpdb->get_results($sql,ARRAY_A) ; $files[] = $file[0]; } } //exit("---------------
".print_r($files,1).""); ?>
"; if ($products[$i]['downloads'] > 0) { echo "".$file['filename'].""; } else { echo $file['filename'].""; } echo " | \n\r"; echo "".$products[$i]['downloads']." | \n\r"; echo "".date("j M Y", strtotime($products[$i]['datetime']))." | \n\r"; echo " \n\r"; $i++; } ?>