Last active
July 25, 2018 08:05
-
-
Save adicuco/3cee170c6a63599f1ddd335b37bd9970 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $user_id = get_current_user_id(); | |
| $codes = array(); | |
| global $wpdb; | |
| $querystr = "SELECT * FROM wp_wcg_codes"; | |
| $wcg_codes = $wpdb->get_results( $querystr, ARRAY_A); | |
| foreach($wcg_codes as $row){ | |
| $order_id = $row['order_id']; | |
| $order = wc_get_order( $order_id ); | |
| $order_user_id = $order->customer_id; | |
| if($user_id == $order_user_id){ | |
| $car = $row['car_brand'] . " " . $row['car_model']; | |
| $subscription_type = $wpdb->get_var("SELECT order_item_name FROM wp_woocommerce_order_items WHERE order_id = $order_id"); | |
| $code = $row['code']; | |
| $code_row = array($car, $subscription_type, $code); | |
| $codes[] = $code_row; | |
| } | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment